修改文件结构。

This commit is contained in:
unlockable
2023-02-21 10:56:54 +08:00
parent a64cfdd9f3
commit 40182871f4
83 changed files with 0 additions and 0 deletions

23
POP/05/Exercise03.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
int main() {
int input = 0;
int digit = 0;
int digits[5] = {0};
scanf("%d", &input);
while (input != 0) {
digits[digit] = input % 10;
input /= 10;
digit++;
}
printf("This number has %d digit(s).\n", digit);
printf("To print every digit in a seperate line:\n");
for (int i = digit - 1; i >= 0; i--) {
printf("%d\n", digits[i]);
}
printf("To output it reversely: ");
for (int i = 0; i < digit; i++) {
printf("%d", digits[i]);
}
return 0;
}