Sunday, 15 September 2013

PROGRAM TO FIND THE POSSIBLE PRIME FACTORS OF THE ENTERED NUMBER

/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int num,i,j=2,k;
    cout<<"enter the nubmer\n";
    cin>>num;
    cout<<"the result is \n";
    while(num>1)
    {
        if(num==0||num==1)
            cout<<"\nno possible prime factors for the entered number\n";
        else
        {
            if(num%j==0)
            {
                cout<<j<<"\n";
                num=num/j;
            }
            else
                j++;
        }
    }
}

No comments:

Post a Comment