Finished first group of assignments
This commit is contained in:
8
programs/lst22/info.json
Normal file
8
programs/lst22/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "List 2ー2 +$\\\\alpha$",
|
||||
"description": "2桁以上の正の整数の十の位の数字を表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/lst22.png"
|
||||
}
|
||||
}
|
||||
BIN
programs/lst22/main
Executable file
BIN
programs/lst22/main
Executable file
Binary file not shown.
18
programs/lst22/main.c
Normal file
18
programs/lst22/main.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Integer n: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
// Don't trust user input
|
||||
if (n < 10) {
|
||||
printf("Integer n must be more than 2 digits.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Tens digit of interger n is %d.", n / 10 % 10);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user