View Code of Problem 79

#include<stdio.h>
int main()
{
	int n,m;
  	int a[100],b[100];
  	scanf("%d",&n);
  	for(int i=0;i<n)
        {
        	scanf("%d",a[i]);
        }
  	scanf("%d",&m);
  	for(int i=0;i<n;i++)
        {
        	b[(i+m)%n]=a[i];
        }
  	for(int i=0;i<n;i++)
        {
        	scanf("%d",b[i]);
        }
  	return 0;
}
/*
Main.c: In function 'main':
Main.c:7:19: error: expected ';' before ')' token
    for(int i=0;i<n)
                   ^
                   ;
Main.c:9:18: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
          scanf("%d",a[i]);
                 ~^  ~~~~
Main.c:18:18: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
          scanf("%d",b[i]);
                 ~^  ~~~~
*/

Double click to view unformatted code.


Back to problem 79