
write a c program to input a number and print all its divisors using while loop.

Hi Friend,
Try the following code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
clrscr();
ptintf("\n Enter Number: \n");
scanf("%d",&n);
for(i=2;i<=n;i++){
if(n%i==0){
printf("\t %d",i);
n=n/i;
i--;
}
}
getch();
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.