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


Please Help Members By Posting Answers For Below Questions

illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1576


explain what are actual arguments?

630


Explain pointer. What are function pointers in C?

622


Is there a way to compare two structure variables?

610


What is anagram in c?

510






Describe explain how arrays can be passed to a user defined function

597


What is the use of getch ()?

627


how to introdu5ce my self in serco

1519


can anyone suggest some site name..where i can get some good data structure puzzles???

1639


Explain what math functions are available for integers? For floating point?

607


Mention four important string handling functions in c languages .

617


What is nested structure in c?

603


can we have joblib in a proc ?

1650


What is a dynamic array in c?

587


What is structure packing in c?

601