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
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
When can a far pointer be used?
Define macros.
#include
Write a program to generate the Fibinocci Series
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
Write a program to swap two numbers without using third variable in c?
Differentiate between null and void pointers.
On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area
Explain what is the stack?
Why is c called c not d or e?
How can I get random integers in a certain range?
Does c have class?
What is the deal on sprintf_s return value?
What is a header file?