Write a program to generate prime factors of a given integer?
Answer Posted / priyanka chauhan
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the no: ");
scanf("%d",&n);
for(j=2;j<=n;j++)
{
if(n%j==0)
{
for(i=2;i<=j-1;i++)
{
if(j%i==0)
break;
}
if(i==j)
printf("%d ",j);
}
}
getch();
}
| Is This Answer Correct ? | 23 Yes | 18 No |
Post New Answer View All Answers
How would you obtain the current time and difference between two times?
What is %lu in c?
What is scanf_s in c?
How do you sort filenames in a directory?
Explain how can I right-justify a string?
What is a char c?
Explain the term printf() and scanf() used in c language?
Write a code of a general series where the next element is the sum of last k terms.
What is the acronym for ansi?
Explain the meaning of keyword 'extern' in a function declaration.
Why c is called a middle level language?
What is double pointer?
When was c language developed?
Write programs for String Reversal & Palindrome check
What is the use of getchar() function?