Search This Blog

Translate

C program To check number is even or odd and prime or not

C program  To check number is even or odd and prime or not,
c program to accept a number from user and check number is even or odd and prime or not

#include
#include
void main()
{
int no,i,flag=0;
clrscr();
printf("Enter the number=");
scanf("%d",&no);
if(no%2==0)
{
printf("\n\n%d is Even number.",no);
}
else
{
printf("\n\n%d is Odd number.",no);
}
for(i=2;i
{
if(no%i==0)
{
flag=1;
break;
}
}
if(flag==1)
{
printf("\n\n%d is not a prime number.",no);
}
else
{
printf("\n\n%d is a prime number.",no);
}
getch();
}


C program  To check number is even or odd and prime or not,
c program to accept a number from user and check number is even or odd and prime or not

C Program example List

Google+ Badge