Monday, May 20, 2019

FIND FACTORS OF A NUMBER IN C PROGRAMING

#include<stdio.h>
#include<conio.h>
int main()
{
int i ,n;
printf("Enter the no.: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
 {
   printf("\n%d ",i);
 }
}
}


Output:

Enter the no.: 20

 1
2
4
5
10
20



No comments:

Post a Comment