Write a C program for finding whether a given number is even or odd.
Write a C program for finding whether a given number is even or odd.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is a simple C program to determine whether a given number is even or odd:
Explanation:
#include <stdio.h>
is used to include the standard input-output library.number
is declared to store the user input.scanf
.if
statement checks if the number is even (number % 2 == 0
). If true, it prints that the number is even. Otherwise, it prints that the number is odd.return 0;
, indicating successful execution.This concise program efficiently determines the parity of a given integer.