C Program - Even Odd
C Program to find the number is even or odd.
#include<stdio.h>
void main() //Start program with library files and and function.
{
int num; // Declaring the Variable num with Integer datatype.
printf("Enter the Number = "); // Display the message to user to enter the number.
scanf("%d", &num); // Input the value written by user and store it in num variable
if (num % 2 == 1) // If the remainder remain after dividing by 2 is 1, then it is Odd.
printf("The Number entered %d is Odd.", num); //If the condition is true print The entered number is Odd.
else
printf("The Number Entered %d is Even.", num); //If the condition is false, then print the entered number is even.
getch();
} // Program Ends
#include<stdio.h>
void main() //Start program with library files and and function.
{
int num; // Declaring the Variable num with Integer datatype.
printf("Enter the Number = "); // Display the message to user to enter the number.
scanf("%d", &num); // Input the value written by user and store it in num variable
if (num % 2 == 1) // If the remainder remain after dividing by 2 is 1, then it is Odd.
printf("The Number entered %d is Odd.", num); //If the condition is true print The entered number is Odd.
else
printf("The Number Entered %d is Even.", num); //If the condition is false, then print the entered number is even.
getch();
} // Program Ends
Comments
Post a Comment