View Code of Problem 57

#include<stdio.h>
int main()
{
 int n,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
  for(j=0;j<n-i;j++)
    printf(" ");
    for(j=1;j=<i+1;j++)
      printf("%d",j);
    for(j=i;j>0;j--)
      printf("%d",j);
    printf("\n");
  
  }
  for(i=1;i<=n-1;i++)
  {
   for(j=1;j=<i;j++)
     printf(" ");
     for(j=1;j<=n-i;j++)
       printf("%d",j);
     for(j=1;j<n-i;j--)
       printf("%d",j);
    printf("\n");
       
  }
  return 0;
}
/*
Main.c: In function 'main':
Main.c:8:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for(j=0;j<n-i;j++)
   ^~~
Main.c:10:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for(j=1;j=<i+1;j++)
     ^~~
Main.c:10:15: error: expected expression before '<' token
     for(j=1;j=<i+1;j++)
               ^
Main.c:19:14: error: expected expression before '<' token
    for(j=1;j=<i;j++)
              ^
Main.c:19:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    for(j=1;j=<i;j++)
    ^~~
Main.c:21:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
      for(j=1;j<=n-i;j++)
      ^~~
*/

Double click to view unformatted code.


Back to problem 57