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
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
Can include files be nested?
What is action and transformation in spark?
Is c programming hard?
Explain how can type-insensitive macros be created?
Where static variables are stored in memory in c?
What is a structure in c language. how to initialise a structure in c?
What does p mean in physics?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
Explain what is the difference between a string and an array?
What does struct node * mean?
Can a program have two main functions?
What is use of pointer?
What does int main () mean?
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.