Write a program to generate prime factors of a given integer?
Answer Posted / sourav das
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,n;
clrscr();
printf("Enter The Number:");
scanf("%d",&n);
i=1;
while(i<=n)
{
if(n%i==0)
{
j=1;
k=0;
l=1;
while(l<=j)
{
if(j%l==0)
k++;
l++;
}
if(k==2)
{
printf("\n%d is the prime factor of %d",l-1,n);
}
}
i++;
}
getch();
}
| Is This Answer Correct ? | 26 Yes | 24 No |
Post New Answer View All Answers
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
What's the best way of making my program efficient?
What is scope of variable in c?
Are there namespaces in c?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
Why header file is used in c?
What are global variables?
What is the right type to use for boolean values in c?
Here is a neat trick for checking whether two strings are equal
How do you determine the length of a string value that was stored in a variable?
What is #line?
what will be maximum number of comparisons when number of elements are given?
What is return type in c?
What is enumerated data type in c?
What is file in c language?