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
What is the heap?
What is the difference between functions abs() and fabs()?
Why we write conio h in c?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
Explain what does a function declared as pascal do differently?
How can I ensure that integer arithmetic doesnt overflow?
Who is the main contributor in designing the c language after dennis ritchie?
What do you mean by scope of a variable in c?
What is malloc and calloc?
What is c language & why it is used?
Why does the call char scanf work?
What is a macro, and explain how do you use it?
What does %p mean c?
The statement, int(*x[]) () what does in indicate?
program for reversing a selected line word by word when multiple lines are given without using strrev