title: How to generate this pattern in C?
body: <pre><code>%@@@%
  %...%
  %...%
  %...%
  %@@@%
  </code></pre>
  
  <p>Where is my mistake? Please let me know. I am a beginner: I just started programming. I would appreciate your help.</p>
  
  <pre><code>    #include&lt;stdio.h&gt;
      int main(){
      int i,j,num;
      scanf("%d", &amp;num);
  
      for(i=0;i&lt;num;i++){
          for(j=0;j&lt;num;j++){
              if((i==0)||(i==num-1)){
              printf("@");
              }
              else if((j==i-1)||(j==num-1)){
              printf("%");
              }
              else
                  printf(".");
          }
          printf("\n");
      }
  }
  </code></pre>