Sunday, 6 September 2020

Program to check weather the number is odd or even

 /*Program to check weather the number is odd or even*/


#include <stdio.h>

int main ()

{

int a;

printf("Enter the number:");

scanf("%d", &a);

if (a%2==0)

{

printf("the number is even");

}

else 

{

printf("the number is odd");

}

return 0;

}


OUTPUT:

Enter the number:4
the number is odd

DESCRIPTION:

First of all we ask the user to input the number which should be checked and is divided by 2 and the final result is displayed.

No comments:

Post a Comment

If you have any doubt, please ask in the comment section.

Search This Blog

Program to print weather the number is happy or not.

#include <stdio.h> #include <math.h> int main () { int i , j , num , temp , sum = 0 ; printf ( "Enter number\n...