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
Write a program to check whether a number is prime or not using c?
What is structure in c language?
What is the function of multilevel pointer in c?
i have a written test for microland please give me test pattern
What does main () mean in c?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
What is the difference between array_name and &array_name?
What are the data types present in c?
How can a program be made to print the name of a source file where an error occurs?
Explain which function in c can be used to append a string to another string?
Are global variables static in c?
How can I make it pause before closing the program output window?
1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.
What is the default value of local and global variables in c?
Where can I get an ansi-compatible lint?