This program is a simple program that takes an integer input from the user and checks if it is an even number or odd number. It uses the modulus operator(%) to check the remainder of the number when divided by 2. If the remainder is 0, it means the number is divisible by 2 and therefore it is an even number. Else, the number is not divisible by 2 and is an odd number. The program then prints the result using the printf statement.
/* Any integer is input through the keyboard. Write a program to find out whether it is an odd number or even number. (Hint: Use the % (modulus) operator) */ #include<stdio.h> int main() { int n; printf("\nEnter The Value : "); scanf("%d",&n); if(n%2==0) { printf("\n%d is even number",n); } else { printf("\n%d is odd number",n); } return 0; }To download raw file Click Here
Enter The Value : 23 23 is odd number
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions