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


Please Help Members By Posting Answers For Below Questions

What is the heap?

686


What is the difference between functions abs() and fabs()?

651


Why we write conio h in c?

567


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

15505


Explain what does a function declared as pascal do differently?

642






How can I ensure that integer arithmetic doesnt overflow?

608


Who is the main contributor in designing the c language after dennis ritchie?

553


What do you mean by scope of a variable in c?

544


What is malloc and calloc?

575


What is c language & why it is used?

582


Why does the call char scanf work?

620


What is a macro, and explain how do you use it?

629


What does %p mean c?

632


The statement, int(*x[]) () what does in indicate?

647


program for reversing a selected line word by word when multiple lines are given without using strrev

1947