C programming code to list all factors of n

Share This Topic:
  •  
  •  
  •  
  •  
  •  

Course Details

Field of Study: Computer Science and Engineering
Course Name: C Programming
Course Description: C programming code to list all factors of n

Code
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n;
printf(“Enter the number\n”);
scanf(“%d”,&n);
for(int i=1;i<=n;i++)
{
if(n%i==0)
printf(“%d “,i);
}
getch();
}

Add a Comment

Your email address will not be published. Required fields are marked *