/*To find the factors of a given number*/
#include<stdio.h>
void
main()
{
int
n,i;
printf("enter
the number i:");
scanf("%d",&n);
printf("the
fators of the number are:\n");
for(i=1;i<n;i++)
{
if(n%i==0)
printf("%d\n",i);
}
}
Result:
enter the number i:1200
the fators of the number are:
1
2
3
4
5
6
8
10
12
15
16
20
24
25
30
40
48
50
60
75
80
100
120
150
200
240
300
400
600
Press any key to continue
No comments:
Post a Comment
Thanks for comment.