C++ Program to find Factors of Any Number

 #include<iostream>

using namespace std;


void line()

{

cout<<"**********************************\n";

}


int main()

{

int i,n;

line();

cout<<"FACTORS OF ANY NUMBER\n";

line();

cout<<"Enter N: ";

cin>>n;

cout<<"Factors of "<<n<<" are: 1 , ";

for(i=2;i<n;i++)

{

if(n%i==0)

{

  cout<<i<<", ";

}

}

cout<<" And the number itself \n";

cout<<"\b\b\n";

line();

}





Comments

Popular posts from this blog