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
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What are integer variable, floating-point variable and character variable?
What are lookup tables in c?
What are examples of structures?
What is the c value paradox and how is it explained?
What is the difference between array_name and &array_name?
How can you read a directory in a C program?
What do you mean by Recursion Function?
Explain the advantages and disadvantages of macros.
What is the use of gets and puts?
Explain what is the purpose of "extern" keyword in a function declaration?
What is a newline escape sequence?
What are the 5 types of organizational structures?
What is the right type to use for boolean values in c? Is there a standard type?
What is extern storage class in c?