2ちゃんねる ■掲示板に戻る■ 全部 1- 最新50    

■ このスレッドは過去ログ倉庫に格納されています

【2018年4月開学】東京通信大学Part.3

49 :名無し生涯学習:2018/11/05(月) 17:34:03.19 ID:imlADz+D0.net
48さん

3−2なんですが
#include <stdio.h>

int main(int argc, char *argv[]){
int d, s, i;

scanf("%d", &n);
s= 0;
for(i= 0; i!=n; i++){
scanf("%d", &d);
s+= d;
}
printf("%d\n", s);
printf("%d\n", i);
printf("%.3f\n", (double)s/i);

return 0;
}
とかいたところ
コンパイルに失敗しました
p2-2.c: In function 'main':
p2-2.c:6:18: error: 'n' undeclared (first use in this function)
scanf("%d", &n);
^
p2-2.c:6:18: note: each undeclared identifier is reported only once for each function it appears inとでます

総レス数 1009
319 KB
新着レスの表示

掲示板に戻る 全部 前100 次100 最新50
read.cgi ver.24052200