draft
This commit is contained in:
10
programs/p411/info.json
Normal file
10
programs/p411/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-11",
|
||||
"description": "教科書のList 4-10の出力に入力値も表示するように変更したプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p411.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p411/main
Executable file
BIN
programs/p411/main
Executable file
Binary file not shown.
23
programs/p411/main.c
Normal file
23
programs/p411/main.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
do {
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
if (n <= 0) {
|
||||
puts("\aPlease input non-negative, non-zero integer.");
|
||||
}
|
||||
} while (n <= 0);
|
||||
|
||||
printf("Reverse of %d is ", n);
|
||||
while (n > 0) {
|
||||
printf("%d", n % 10);
|
||||
n /= 10;
|
||||
}
|
||||
|
||||
puts(".");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user