Previous: 問題6
Up: No Title
Next: 前期のまとめ
Previous Page: 問題6
Next Page: 前期のまとめ
A quick brown fox jumps over the lazy dog.
解答例 #include <stdio.h> main() { printf("A quick brown fox jumps\nover the lazy dog.\n"); }
解答例 #include <stdio.h> main() { int i; for (i=15; i<100; i+=15){ printf(" %d \n", i); } }
解答例 #include <stdio.h> main() { int score;printf("Input your score = "); scanf("%d", &score);
if (score > 100 || score < 0){ printf("入力が間違いです。もう一度やり直して下さい。\n") }else if (score >= 90){ printf("Great\n"); }else if (score >= 70){ printf("Good\n"); }else if (score >= 60){ printf("Ok\n"); }else{ printf("Tuishi\n"); } }
解答例 #include <stdio.h> main() { int money, month;money = 100000; for (month=0; month<12; month++){ money = money * 1.08; }
printf("返済金額は、%d 円です。", money); }
解答例 #include <stdio.h> main() { int a, hour, min, sec;printf("秒数を入力して下さい。"); scanf("%d", &a);
hour = a / 3600; a = a - hour * 3600; min = a / 60; sec = a - 60 * min;
printf("%d 時間 %d 分 %d 秒\n", hour, min, sec); }
答 1 時間 5 分 47 秒