answer.code: In function ‘main’:
answer.code:7:13: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 3 has type ‘long long int *’ [-Wformat=]
7 | scanf("%d%ld",&n,&k);
| ~~^ ~~
| | |
| | long long int *
| long int *
| %lld
answer.code:9:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
9 | for(int i=0;i<n;i++){
| ^~~
answer.code:9:2: note: use option ‘-std=c99’, ‘-std=gnu99’, ‘-std=c11’ or ‘-std=gnu11’ to compile your code
answer.code:10:12: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
10 | scanf("%ld",&a[i]);
| ~~^ ~~~~~
| | |
| | long long int *
| long int *
| %lld
answer.code:13:6: error: redeclaration of ‘i’ with no linkage
13 | int i;
| ^
answer.code:9:10: note: previous definition of ‘i’ was here
9 | for(int i=0;i<n;i++){
| ^
answer.code:18:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
18 | for(int j=0;j<n;j++){
| ^~~
answer.code:24:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
24 | for(int t=0;t<n;t++){
| ^~~
answer.code:27:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
27 | for(int j=0;j<k-i;j+=n){
| ^~~
answer.code:30:12: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long long int’ [-Wformat=]
30 | printf("%ld",sum);
| ~~^ ~~~
| | |
| | long long int
| long int
| %lld
answer.code:7:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
7 | scanf("%d%ld",&n,&k);
| ^~~~~~~~~~~~~~~~~~~~
answer.code:10:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
10 | scanf("%ld",&a[i]);
| ^~~~~~~~~~~~~~~~~~