27 lines
425 B
C
27 lines
425 B
C
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
int n;
|
|
int factors = 0;
|
|
|
|
numInput:
|
|
printf("Input integer: ");
|
|
scanf("%d", &n);
|
|
|
|
if (n < 1) {
|
|
puts("Please input positive integer.");
|
|
goto numInput;
|
|
}
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
if (n % i == 0) {
|
|
printf("%d\n", i);
|
|
factors++;
|
|
}
|
|
}
|
|
|
|
printf("Number of factors: %d\n", factors);
|
|
|
|
return 0;
|
|
}
|