2:10 PM
c++ Program of PRIME FACTORS OF A NUMBER

Write a Program of  PRIME FACTORS OF A NUMBER

#include<iostream.h> 
#include<conio.h> 
 
void main()
{
int num,i=1,j,k;
clrscr();
printf("\nEnter a 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%d is a prime factor",i);
}
i++;
}
getch();
}
 
 
Note:    
           If you want to change in this program please write through the comment on this page. you can also past similar program of 
             c++ with output.your comment is valuable to the other user and person.
Views: 107 | Added by: vijoriya | Tags: Number, c++, PRIME FACTORS, program | Rating: 0.0/0
Total comments: 0
avatar