View Code of Problem 45

#include <stdio.h>
int main()
{
	int a[100][100];
  	int i,j,n;
  	scanf("%d",&n);
  	for(i=0;i<n;++i)
          for(j=0;j<n;++j)
            scanf("%d",&a[i]);
          
          for(i=0;i<n;++i)
            for(j=0;j<n;++j)
            {
            	if(j=n-1)
                  printf("%d\n",a[i]);
              else
                printf("%d "a[i]);
            
            
            
            }
          
  	




}
/*
Main.c: In function 'main':
Main.c:9:13: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int (*)[100]' [-Wformat=]
             scanf("%d",&a[i]);
             ^
Main.c:14:14: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
              if(j=n-1)
              ^
Main.c:15:19: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
                   printf("%d\n",a[i]);
                   ^
Main.c:17:29: error: expected ')' before 'a'
                 printf("%d "a[i]);
                             ^
Main.c:17:29: warning: format '%d' expects a matching 'int' argument [-Wformat=]
*/

Double click to view unformatted code.


Back to problem 45