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 is use of bit field?
What is double pointer?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
How do I round numbers?
What is the difference between declaring a variable and defining a variable?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
Why is event driven programming or procedural programming, better within specific scenario?
How can you avoid including a header more than once?
Explain the properties of union. What is the size of a union variable
What is "Hungarian Notation"?
When should I declare a function?
How do you print only part of a string?
What are logical errors and how does it differ from syntax errors?
Write the syntax and purpose of a switch statement in C.
What does the error message "DGROUP exceeds 64K" mean?