int a,b;
printf("enter nember: ");
scanf("%d %d",&a,&b);
printf("%d",a+b);
求神解救
第 1 測資點(10%): CE ()
編譯錯誤
/code_2438557.c:2:8: error: expected declaration specifiers or ‘...’ before string constant printf("enter nember: "); ^ /code_2438557.c:3:7: error: expected declaration specifiers or ‘...’ before string constant scanf("%d %d",&a,&b); ^ /code_2438557.c:3:17: error: expected declaration specifiers or ‘...’ before ‘&’ token scanf("%d %d",&a,&b); ^ /code_2438557.c:3:20: error: expected declaration specifiers or ‘...’ before ‘&’ token scanf("%d %d",&a,&b); ^ /code_2438557.c:4:8: error: expected declaration specifiers or ‘...’ before string constant printf("%d",a+b); ^ /code_2438557.c:4:13: error: expected declaration specifiers or ‘...’ before ‘a’ printf("%d",a+b); ^
int a,b;
printf("enter nember: ");
scanf("%d %d",&a,&b);
printf("%d",a+b);
求神解救
第 1 測資點(10%): CE ()
編譯錯誤
/code_2438557.c:2:8: error: expected declaration specifiers or ‘...’ before string constant printf("enter nember: "); ^ /code_2438557.c:3:7: error: expected declaration specifiers or ‘...’ before string constant scanf("%d %d",&a,&b); ^ /code_2438557.c:3:17: error: expected declaration specifiers or ‘...’ before ‘&’ token scanf("%d %d",&a,&b); ^ /code_2438557.c:3:20: error: expected declaration specifiers or ‘...’ before ‘&’ token scanf("%d %d",&a,&b); ^ /code_2438557.c:4:8: error: expected declaration specifiers or ‘...’ before string constant printf("%d",a+b); ^ /code_2438557.c:4:13: error: expected declaration specifiers or ‘...’ before ‘a’ printf("%d",a+b); ^
其實不用輸出多餘的字"enter number"