Write a program to generate prime factors of a given integer?
Answer Posted / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int num,i,f=0,k=0,d,m;
printf("\n Enter the number ");
scanf("%d",&num);
m=num;
while(k<=m)
{
k=k+1;
f=0;
d=num%k;
if(d==0)
{
i=2;
while(i<=k-1)
{
if(k%i==0)
{
break;
}
i++;
}
if(i==k)
{
printf("\nPrime Factor %d ",k);
}
}
}
getch();
}
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Explain what are the standard predefined macros?
Give basis knowledge of web designing ...
What is malloc and calloc?
What is the difference between struct and union in C?
C program to find all possible outcomes of a dice?
When is a void pointer used?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
What is the function of multilevel pointer in c?
Explain the use of #pragma exit?
What are comments and how do you insert it in a C program?
What is the general form of a C program?
What is a stream water?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
Write a code on reverse string and its complexity.
using for loop sum 2 number of any 4 digit number in c language