draft
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"language": "",
|
||||
"name": "",
|
||||
"description": "",
|
||||
"language": "C",
|
||||
"name": "演習 3-13",
|
||||
"description": "教科書のList 3-18 をSwitch文で書き換えたプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot | text",
|
||||
"content": ""
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p313.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
|
||||
BIN
programs/p313/main
Executable file
BIN
programs/p313/main
Executable file
Binary file not shown.
@@ -0,0 +1,35 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int month;
|
||||
|
||||
printf("Input month: ");
|
||||
scanf("%d", &month);
|
||||
|
||||
switch (month) {
|
||||
case 12:
|
||||
case 1:
|
||||
case 2:
|
||||
puts("It is winter.");
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
puts("It is spring.");
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
puts("It is summer.");
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
puts("It is autumn.");
|
||||
break;
|
||||
default:
|
||||
puts("Unknown month.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user