#include<stdio.h>
#include<conio.h>
void main( )
{
clrscr( ) ;
int num,count=0;
printf(" ENTER THE NUMBER TO CHECK IT IS PRIME OR NOT " ) ;
scanf("%d", &num);
for(int i=0;i<=num;i++)
{
if(num%a= = 0) //if statement used
{ count++ ; }
}
if(count= =2) //if else selection statement used
{
printf("Prime Number");
}
else
{
printf("Not a Prime Number");
}
getch( );
}
#include<conio.h>
void main( )
{
clrscr( ) ;
int num,count=0;
printf(" ENTER THE NUMBER TO CHECK IT IS PRIME OR NOT " ) ;
scanf("%d", &num);
for(int i=0;i<=num;i++)
{
if(num%a= = 0) //if statement used
{ count++ ; }
}
if(count= =2) //if else selection statement used
{
printf("Prime Number");
}
else
{
printf("Not a Prime Number");
}
getch( );
}
No comments:
Post a Comment