This commit is contained in:
2025-07-03 12:05:57 +09:00
parent e10edbe753
commit fea9a38b1d
27 changed files with 255 additions and 98 deletions

10
programs/p41/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "課題1",
"description": "教科書の演習4ー1の解答",
"output": {
"type": "screenshot",
"content": "./assets/p41.png"
},
"note": ""
}

BIN
programs/p41/main Executable file

Binary file not shown.

24
programs/p41/main.c Normal file
View File

@@ -0,0 +1,24 @@
#include <stdio.h>
int main(void) {
int n;
int retry = 1;
do {
printf("Input integer: ");
scanf("%d", &n);
if (n > 0) {
printf("%d is positive.\n", n);
} else if (n < 0) {
printf("%d is negative.\n", n);
} else {
printf("It is zero.\n");
}
printf("Retry? [1/0]: ");
scanf("%d", &retry);
} while (retry == 1);
return 0;
}