Write a program to generate prime factors of a given integer?
Answer Posted / neha
#include<stdio.h>
#include<conio.h>
int main()
{
int num,i=1,j,k;
printf("\n\tEnter the number:");
scanf("%d",&num);
while(i<=num)
{
k=0;
if(num%i==0)
{
j=1;
while(j<=i)
{
if(i%j==0)
k++;
}
j++;
if(k==2)
printf("\n\t%d is a Prime factor:"i);
}
i++;
}
return 0;
}
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Can include files be nested?
Why is this loop always executing once?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
What functions are in conio h?
What are the different file extensions involved when programming in C?
How many header files are in c?
What is the use of static variable in c?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
Explain spaghetti programming?
Explain what’s a signal? Explain what do I use signals for?
Explain how can you check to see whether a symbol is defined?
What does void main return?
Explain setjmp()?
Write a factorial program using C.
Explain how do you sort filenames in a directory?