1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#include <stdio.h> #define N 3 void main() { char *kamoku_list[] = { "koku", "suu", "ei" }; int seiseki[N][3]; for (int i = 0; i < N; i++) { printf("seito no.%d\n", i + 1); for (int j = 0; j < 3; j++) { printf("%s = ", kamoku_list[j]); scanf("%d", &seiseki[i][j]); } } printf("--------------------\n"); printf("%2s%6s%6s%6s\n", "no", "koku", "suu", "ei"); for (int i = 0; i < N; i++) { printf("%2d", i + 1); for (int j = 0; j < 3; j++) printf("%6d", seiseki[i][j]); printf("\n"); } }