progress
This commit is contained in:
10
programs/a4/info.json
Normal file
10
programs/a4/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "課題4",
|
||||
"description": "1年の月の日数を返すプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/a4.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/a4/main
Executable file
BIN
programs/a4/main
Executable file
Binary file not shown.
29
programs/a4/main.c
Normal file
29
programs/a4/main.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int month;
|
||||
|
||||
printf("Input month: ");
|
||||
scanf("%d", &month);
|
||||
|
||||
if (month < 1 || month > 12) {
|
||||
puts("Unknown month");
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (month) {
|
||||
case 2:
|
||||
puts("28 days");
|
||||
break;
|
||||
case 4:
|
||||
case 6:
|
||||
case 9:
|
||||
case 11:
|
||||
puts("30 days");
|
||||
break;
|
||||
default:
|
||||
puts("31 days");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user