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

How will you find a duplicate number in a array without negating the nos ?

2183


Explain output of printf("Hello World"-'A'+'B'); ?

1557


Why c is called object oriented language?

1113


What are the different types of objects used in c?

1080


Where static variables are stored in c?

1166


Explain data types & how many data types supported by c?

1131


What do you mean by command line argument?

1224


What are header files in c?

1120


Explain the Difference between the New and Malloc keyword.

1185


Which header file is used for clrscr?

1106


What is sorting in c plus plus?

1025


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4332


Explain what is the advantage of a random access file?

1175


What is string constants?

1202


Explain how do you list files in a directory?

1112