作业帮 > 综合 > 作业

C语言 $ ./factors Enter number: 1001 The factors of 1001 are:

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/04/30 10:26:33
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
C语言 $ ./factors Enter number: 1001 The factors of 1001 are:
#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