Mar 13, 2020

C Program To Print Given Number Is Even or Odd

EX: what is logic to print given number is even or odd. C program to print given number is even or odd.how to print given number is even or odd.




Logic to print given number is even or odd:

1. In this Program we will take number from user using no variable. 


2. Next we will check it is even or odd using the (no%2==0).

3. Means if no is complete divisible by 2 then it is even otherwise number is odd.

4. Display this output using input/output function.




Program: 

#include<stdio.h>

void main()
{
int no; 

printf("Enter the number\n");

scanf("%d",&no);

if(no%2==0)
printf("Given number is Even\n");

else
printf("Given number is Odd\n");

}


Above Program's show's the following output:






Share This:    Facebook Twitter

0 comments:

Post a Comment

If you have any doubts, please discuss here...