draft
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"language": "",
|
||||
"name": "",
|
||||
"description": "",
|
||||
"language": "C",
|
||||
"name": "演習 3-12",
|
||||
"description": "教科書のList 3-4をSwitch文で書き換えたプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot | text",
|
||||
"content": ""
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p312.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
|
||||
BIN
programs/p312/main
Executable file
BIN
programs/p312/main
Executable file
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input Integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
switch (n % 2) {
|
||||
case 0:
|
||||
puts("The number is even.");
|
||||
break;
|
||||
case 1:
|
||||
puts("The number is odd.");
|
||||
break;
|
||||
default:
|
||||
puts("Unknown Error");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user