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 / mohammad nasim

include<stdio.h>
main()
{
int n;
printf("Enter a positive integer: ");
scanf("%d",&n);
printf("\nThe prime factors are:\n");
while((n/2)!= 0 || (n/3)!=0)
{
if(n%2==0)
{
printf("\t2");
n=n/2;
}
else
{
if(n%3==0)
{
printf("\t3");
n = n/3;
}
else
{
printf("\t%d",n);
break;
}

}
}

}

Is This Answer Correct ?    1 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1651


What is a program flowchart and explain how does it help in writing a program?

1225


What is the purpose of the statement: strcat (S2, S1)?

1076


Here is a good puzzle: how do you write a program which produces its own source code as output?

1036


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

1200


What is the sizeof () a pointer?

925


What is a program flowchart and how does it help in writing a program?

1083


When should you not use a type cast?

1070


Explain what is the stack?

1041


What do you mean by dynamic memory allocation in c?

1050


What is the use of pragma in embedded c?

1003


in iso what are the common technological language?

2048


Explain how can you tell whether two strings are the same?

971


Explain what are the different data types in c?

1160


Place the #include statement must be written in the program?

989