Write a program to generate prime factors of a given integer?
Answer Posted / sourav das
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,n;
clrscr();
printf("Enter The Number:");
scanf("%d",&n);
i=1;
while(i<=n)
{
if(n%i==0)
{
j=1;
k=0;
l=1;
while(l<=j)
{
if(j%l==0)
k++;
l++;
}
if(k==2)
{
printf("\n%d is the prime factor of %d",l-1,n);
}
}
i++;
}
getch();
}
| Is This Answer Correct ? | 26 Yes | 24 No |
Post New Answer View All Answers
What are register variables in c?
Why c is called procedure oriented language?
what will be the output for the following main() { printf("hi" "hello"); }
Can we initialize extern variable in c?
What is n in c?
How can this be legal c?
can we change the default calling convention in c if yes than how.........?
Is c compiled or interpreted?
What is a newline escape sequence?
What are near, far and huge pointers?
What is a file descriptor in c?
what is a function method?give example?
What are local static variables? How can you use them?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
What is a example of a variable?