Write a program to generate prime factors of a given integer?

Answer Posted / ruchi

#include<stdio.h>
#include<conio.h>
int main()
{
int num,i,f=0,k=0,d,m;
printf("\n Enter the number ");
scanf("%d",&num);
m=num;
while(k<=m)
{
k=k+1;
f=0;
d=num%k;
if(d==0)
{
i=2;
while(i<=k-1)
{
if(k%i==0)
{
break;
}
i++;
}
if(i==k)
{
printf("\nPrime Factor %d ",k);
}
}
}
getch();
}

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Wt are the Buses in C Language

2765


What is the use of f in c?

566


Define Array of pointers.

644


What type of function is main ()?

600


Explain how are portions of a program disabled in demo versions?

665






How can I read a binary data file properly?

641


How can variables be characterized?

1661


What is table lookup in c?

641


Write a program which returns the first non repetitive character in the string?

612


Explain what is the difference between null and nul?

673


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

1132


What are different types of variables in c?

579


What are the modifiers available in c programming language?

753


Why do we use main function?

650


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

1886