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
What is the benefit of using #define to declare a constant?
Explain how do you print an address?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
What are the scope of static variables?
What is getch?
What is your stream meaning?
What are the 5 organizational structures?
What was noalias and what ever happened to it?
#include
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What is a spanning Tree?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
c program for searching a student details among 10 student details
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What is meant by errors and debugging?