#include <stdio.h>

#include <conio.h>

void main()

{

int flag=0,i,n,r,a[100],b=0,s;

clrscr();

printf("\n Enter Number: ");

scanf("%d",&n);

for(i=2;i<=n/2;i++)

{

r=n%i;

if(r==0)

{

flag=s;

a[b]=i;

b++;

}

}

if(flag==s)

{

printf(" So The Number %d is not prime",n);

printf("\n The factors are: ");

for(i=0;i<b;i++)

{

printf("%d ",a[i]);

}

}

else

{

printf("\n So The Number %d is prime",n);

}

getch();

}

#include <conio.h>

void main()

{

int flag=0,i,n,r,a[100],b=0,s;

clrscr();

printf("\n Enter Number: ");

scanf("%d",&n);

for(i=2;i<=n/2;i++)

{

r=n%i;

if(r==0)

{

flag=s;

a[b]=i;

b++;

}

}

if(flag==s)

{

printf(" So The Number %d is not prime",n);

printf("\n The factors are: ");

for(i=0;i<b;i++)

{

printf("%d ",a[i]);

}

}

else

{

printf("\n So The Number %d is prime",n);

}

getch();

}

## No comments:

## Post a Comment