Technology Lesson
Showing posts with label
divisers
.
Show all posts
Showing posts with label
divisers
.
Show all posts
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();
}
Read more »
Older Posts
Home
Subscribe to:
Posts (Atom)