Write a program to generate prime factors of a given integer?
Answer Posted / neha
#include<stdio.h>
#include<conio.h>
int main()
{
int num,i=1,j,k;
printf("\n\tEnter the number:");
scanf("%d",&num);
while(i<=num)
{
k=0;
if(num%i==0)
{
j=1;
while(j<=i)
{
if(i%j==0)
k++;
}
j++;
if(k==2)
printf("\n\t%d is a Prime factor:"i);
}
i++;
}
return 0;
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Is c object oriented?
What is bash c?
What is the role of && operator in a program code?
How can you avoid including a header more than once?
what is the difference between class and unio?
What is a program flowchart?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
Explain output of printf("Hello World"-'A'+'B'); ?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
What is pointer to pointer in c with example?
What is the difference between malloc() and calloc()?
Why C language is a procedural language?
Explain what is #line used for?
How can you increase the allowable number of simultaneously open files?
What is pointer & why it is used?