Write a program to generate prime factors of a given integer?
Answer Posted / courage
#include<stdio.h>
int main()
{
int num=0;
printf("Enter number\n");
scanf("%d",&num);
int i,count=0,j;
for (i=1;i<=num;i++)
{
if (num%i==0)
{
for (j=1;j<=i;j++)
{
if(i%j==0)
{
count=count+1;
}
}
if (count==2)
{
printf("%d",i);
}
count=0;
}
}
}
Is This Answer Correct ? | 4 Yes | 16 No |
Post New Answer View All Answers
Explain what is wrong with this statement? Myname = ?robin?;
When c language was developed?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
Why we write conio h in c?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
What does *p++ do?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
What is extern c used for?
pierrot's divisor program using c or c++ code
Which is more efficient, a switch statement or an if else chain?
explain what is an endless loop?
Is the exit() function same as the return statement? Explain.
Explain why C language is procedural?
What is the benefit of using #define to declare a constant?
What are the scope of static variables?