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
Do you know what are the properties of union in c?
What is string constants?
Explain how can type-insensitive macros be created?
What is dynamic variable in c?
What is the equivalent code of the following statement in WHILE LOOP format?
Did c have any year 2000 problems?
Is c a great language, or what?
Explain how can a program be made to print the name of a source file where an error occurs?
What is the modulus operator?
Is there a built-in function in C that can be used for sorting data?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
What is structure padding in c?
What is #define in c?
What is the use of f in c?