Subscribe Us

c program to find even or odd number using if else - c exercise – smartduinya

In this post we will learn , how to check a number even or odd by c programming . We all know that If a number is totally divisible by 2 then its an even number , example – 2,4,6,8,10… etc.
Otherwise the number is called odd number , example – 5,7,9.. etc.
Suppose a problem is


Any integer is input through the keyboard . write a program to find out whether it is an odd number or even number


To solve this problem ,
we take a number and divide by 2 if reminder is 0 then the number is even
other wise the number is odd.
Let's Go to the code :


Note :Click on the button to copy the text from the text field. Try to paste the text (e.g. ctrl+v) afterwards in a different window, to see the effect.

write the above code or copy this code . save this with '.c ' extension.In this screen User have to input a number to check it even or odd number . Then press Enter to show even / odd.

When The Number is Even


ex. User give input 100, to Calculate even / odd ?
=> we all know that it is a even number.

OutPut :


When The Number is Odd


ex. User give input 103, to Calculate even / odd ?
=> we all know that it is a odd number.

OutPut :

Post a Comment

0 Comments