Submission #97650


Source Code Expand

Copy
#include<stdio.h>

int main(void){
	int n,sum, cnt;
	int a[] = 0;
	scanf("%d",&n);
	int a[n];
	for(int i=0; i<n; i++){
		scanf("%d", &a[i])
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<i+1;j++){
			cnt++; 
		}
	}
	printf("%d\n",cnt);
}

Submission Info

Submission Time
Task A - コンテスト
User averoom
Language C (GCC 4.6.4)
Score 0
Code Size 251 Byte
Status CE

Compile Error

./Main.c: In function ‘main’:
./Main.c:5:2: error: invalid initializer
./Main.c:7:6: error: redeclaration of ‘a’ with no linkage
./Main.c:5:6: note: previous definition of ‘a’ was here
./Main.c:8:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
./Main.c:8:2: note: use option -std=c99 or -std=gnu99 to compile your code
./Main.c:10:2: error: expected ‘;’ before ‘}’ token
./Main.c:11:10: error: redefinition of ‘i’
./Main.c:8:10: note: previous definition of ‘i’ was here
./Main.c:11:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
./Main.c:12:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
./Main.c:6:7: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
./Main.c:9:8: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]