🔒 Closed Getting prime factors

Status
Not open for further replies.

ken21

Leecher
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i,num;

printf("Enter number:");
scanf("%d",&num);

printf("\nAll prime factors of %d are: ",num);

i=2;

while(num!=0){
if(num%i!=0)
i=i+1;
else{
num=num/i;
printf("\t%d",i);
if(num==1)
break;
}
}
getch();
}
 
Status
Not open for further replies.

About this Thread

  • 4
    Replies
  • 800
    Views
  • 4
    Participants
Last reply from:
jjarongay

Trending Topics

Online now

Members online
1,038
Guests online
1,388
Total visitors
2,426

Forum statistics

Threads
2,278,556
Posts
28,984,230
Members
1,227,457
Latest member
XerxesFaust
Back
Top