Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program to generate prime factors of a given integer?

Answer Posted / rajesh kumar s

int main()
{
int n,num,i;
printf("enter the num");
scanf("%d",&num);
n=num;
printf("\n");
for(i=2;i<=n/2;i++)
{
if(n%i==0)
{
prime(i);
}
}
}

void prime(int x)
{
int i,f=0;
for(i=2;i<=x/2;i++)
{
if(x%i==0)
{
f=1;
break;
}
}
if(f==0)
printf(" %d",x);

}

Is This Answer Correct ?    49 Yes 40 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is actual argument?

1016


How can a number be converted to a string?

1258


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

1221


Write a C program to count the number of email on text

1866


How are structure passing and returning implemented?

1002


Did c have any year 2000 problems?

1069


What is difference between Structure and Unions?

1195


What is getch() function?

1019


What are the types of operators in c?

1017


How are variables declared in c?

1041


what is the basis for selection of arrays or pointers as data structure in a program

4262


Explain how do you print only part of a string?

1175


What is const and volatile in c?

997


What is the use of #define preprocessor in c?

1032


pierrot's divisor program using c or c++ code

2182