Header Ads Widget

C program to check whether a number is even or odd

  C program to check whether a number is even or odd

Given a number , write a program to check whether number is even or odd .

Sample input 

8

Sample output

8 is even

C program to check whether a number is even or odd

The objective of the code is check whether number is even or odd .

Code(C):-

#include<stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a%2==0)
printf("%d is even ",a);
else
printf("%d is odd",a);

return 0;
}

Output:-

8
8 is even

Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments