added programs
This commit is contained in:
10
programs/p311/info.json
Normal file
10
programs/p311/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 3-11",
|
||||
"description": "論理OR演算子を使用して2つの整数値の差が10以下であるか、11以上であるかを検証するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p311.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p311/main
Executable file
BIN
programs/p311/main
Executable file
Binary file not shown.
20
programs/p311/main.c
Normal file
20
programs/p311/main.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int a, b;
|
||||
|
||||
printf("Int A: ");
|
||||
scanf("%d", &a);
|
||||
printf("Int B: ");
|
||||
scanf("%d", &b);
|
||||
|
||||
int diff = a - b;
|
||||
|
||||
if (diff >= 11 || diff <= -11) {
|
||||
printf("Difference is greater than or equal to 11.\n");
|
||||
} else {
|
||||
printf("Difference is less than or equal to 10.\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user