Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define N 3
- int main(void) {
- int test[N], i;
- char buf[BUFSIZ];
- for (i = 0; i < N; i++) {
- puts("テストの点数を入力せよ");
- for (; scanf("%d", &test[i]) == 0;) {
- fgets(buf, BUFSIZ - 1, stdin);
- puts("error.");
- puts("テストの点数を入力せよ");
- }
- if (test[i] < 0 || test[i] > 100) {
- puts("0から100までの整数を入力してください。");
- i--;
- continue;
- }
- }
- for (i = 0; i < N; i++)
- printf("%d人目の点数は %d です。\n", i + 1, test[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement