#include<stdio.h>
#include<conio.h>
void main()
{
int number,stop=0,i;
clrscr();
printf("\n Enter Number : ");
scanf("%d",&number);
for(i=2;i<number;i++)
{
if( (number%i) == 0)
{
stop = 1;
break;
}
}
if(stop == 1 || number == 0 || number == 1)
printf("\nNumber is not prime.");
else
printf("\nNumber is prime.");
getch();
}
#include<conio.h>
void main()
{
int number,stop=0,i;
clrscr();
printf("\n Enter Number : ");
scanf("%d",&number);
for(i=2;i<number;i++)
{
if( (number%i) == 0)
{
stop = 1;
break;
}
}
if(stop == 1 || number == 0 || number == 1)
printf("\nNumber is not prime.");
else
printf("\nNumber is prime.");
getch();
}
0 Comments