Here is C Program to check if a number is odd or even
with a full explanation.
OutPut Of above Code:-
Explanation of above code:-
To check whether given number is EVEN or ODD, we are checking modulus by dividing number by 2, if the modulus is 0, then it will be completely divisible by 2 hence number will be EVEN or its will be ODD.
with a full explanation.
Question:- C Program to check if a number is odd or even
Source Code:-
/* c program to check whether number is even or odd*/ #include <stdio.h> int main() { int num; printf("Enter an integer number: "); scanf("%d",&num); /*If number is divisible by 2 then number is EVEN otherwise number is ODD*/ if(num%2==0) printf("%d is an EVEN number.",num); else printf("%d is an ODD number.",num); return 0; }
OutPut Of above Code:-
Explanation of above code:-
To check whether given number is EVEN or ODD, we are checking modulus by dividing number by 2, if the modulus is 0, then it will be completely divisible by 2 hence number will be EVEN or its will be ODD.
Thanks You..@author Souvik Dey.
Do you want to become a good programmer, Click Here
✽Send Solution and Get Credit✽
Must Read:-
4. Java Programming
5. C programs With source code
Final Word:-
In this article, We have shown you the "C Program to check if a number is odd or even".We hope you like it
5. C programs With source code
Final Word:-
In this article, We have shown you the "C Program to check if a number is odd or even".We hope you like it
If This post helps you a little bit then please share this post with your friends. For more Computer and programming Related Tips and tricks, please
Follow us on Facebook
Follow us on Pinterest
Don't forget to share how you like this Content in the comment below. If you have any doubt or suggestion then please write in the comment section below, we will love to hear from you.
No comments:
Do not add any link in the comments.
For backlink, contact us.