WELCOME IN THE SEA OF C

Here you find some good quality programs.
If any one want any type of help in C and C++ then you can mail me.
Google

Tuesday, January 22, 2008

Prime Factor Generator

Generates the prime factors of a given number

"/" is used instead of "<" and ">."
#include/iostream.h/
#include/iomanip.h/
#include/conio.h/
#include/math.h/
void main()
{ clrscr();
unsigned long int x;
char c='y';
do
{
cout<<"enter the no....."< cin>>x;
cout<<"Factors are...";
do
{
for(unsigned long i=2;i<=x;i++)
{
long f=x%i;
if(f==0)
{
cout<<<" ";
x=x/i;
break;
} } }
while(x!=1);
getch();
cout<<"continue...(y/n)....";
cin>>c;
cout<}
while(c=='y');
}

1 comments:

mithun said...

I actually enjoyed reading through this posting.Many thanks.









Consulting - cPrime