C语言 $ ./factors Enter number: 1001 The factors of 1001 are: 1 7 11 13 77 91 143 1001Write a program factors.c which reads a number n from standard input and prints the factors of n. Compile it to produce an executable called factors.$ ./factorsEn

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/23 18:32:19

C语言 $ ./factors Enter number: 1001 The factors of 1001 are: 1 7 11 13 77 91 143 1001
Write a program factors.c which reads a number n from standard input and prints the factors of n. Compile it to produce an executable called factors.
$ ./factors
Enter number: 1001
The factors of 1001 are:
1
7
11
13
77
91
143
1001

#include
int main()
{
int n, i;
printf("Enter number:");
scanf("%d",&n);
printf("The factors of %d are:\n",n);
printf("1\n");
for(i=2; i