done
This commit is contained in:
10
programs/p414/info.json
Normal file
10
programs/p414/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-14",
|
||||
"description": "1,2,3...8,9,0を入力した整数値個表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p414.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p414/main
Executable file
BIN
programs/p414/main
Executable file
Binary file not shown.
22
programs/p414/main.c
Normal file
22
programs/p414/main.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
numInput:
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n < 0) {
|
||||
puts("Please input positive integer.");
|
||||
goto numInput;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
printf("%d", i % 10);
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user