Write a program to generate prime factors of a given integer?
Answer Posted / courage
#include<stdio.h>
int main()
{
int num=0;
printf("Enter number\n");
scanf("%d",&num);
int i,count=0,j;
for (i=1;i<=num;i++)
{
if (num%i==0)
{
for (j=1;j<=i;j++)
{
if(i%j==0)
{
count=count+1;
}
}
if (count==2)
{
printf("%d",i);
}
count=0;
}
}
}
| Is This Answer Correct ? | 4 Yes | 16 No |
Post New Answer View All Answers
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What is difference between Structure and Unions?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
Why is it that not all header files are declared in every C program?
Describe explain how arrays can be passed to a user defined function
What is the role of && operator in a program code?
What is the purpose of sprintf() function?
how to find binary of number?
Write a code to generate a series where the next element is the sum of last k terms.
what do the 'c' and 'v' in argc and argv stand for?
Why do we use header files in c?
write a program to find the given number is prime or not
How can you access memory located at a certain address?