Wednesday, February 11, 2015

C Program to find divisers of a number


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long int n,i;
cout<<"Enter the number: ";
cin>>n;
cout<<endl<<"Divisers of "<<n<<" are ";
for(i=1;i<=n;++i)
{
if(n%i==0)
cout<<" "<<i;
}
getch();
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.