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.



C  Program To Print Given Number Is Even or Odd: 


#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:



C  Program To Print Given Number Is Even or Odd



No comments:

Post a Comment

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