/****************************/ /* for 文 */ /* coded by Y.Suganuma */ /****************************/ #include <stdio.h> int main() { // 通常の for 文 for (int i = 1; i <= 3; i++) printf("%d ", i); printf("\n"); // 範囲 for 文 double a[3] = {1.5, 5.1, 3.14}; for (auto i : a) printf("%.2f ", i); printf("\n"); // 2 次元配列 int b[3][2] = {{1, 2}, {3, 4}, {5, 6}}; for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { printf("%d", b[i][j]); if (j == 0) printf(","); } printf(" "); } printf("\n"); return 0; }