Write a program to generate prime factors of a given integer?
Answer Posted / priyanka chauhan
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the no: ");
scanf("%d",&n);
for(j=2;j<=n;j++)
{
if(n%j==0)
{
for(i=2;i<=j-1;i++)
{
if(j%i==0)
break;
}
if(i==j)
printf("%d ",j);
}
}
getch();
}
| Is This Answer Correct ? | 23 Yes | 18 No |
Post New Answer View All Answers
Explain bit masking in c?
Explain setjmp()?
explain how do you use macro?
What is queue in c?
Explain what are header files and explain what are its uses in c programming?
What is wrong with this code?
What is c language & why it is used?
Do you know the purpose of 'register' keyword?
#include
Why should I prototype a function?
What is malloc() function?
Does c have class?
Why dont c comments nest?
Define and explain about ! Operator?
How can you tell whether two strings are the same?