forked from seeditsolution/cprogram
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request seeditsolution#219 from Sagarmatsagar321/patch-2
Create Find odd or even no
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* Program to check whether the input integer number | ||
* is even or odd using the modulus operator (%) | ||
*/ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
// This variable is to store the input number | ||
int num; | ||
|
||
printf("Enter an integer: "); | ||
scanf("%d",&num); | ||
|
||
// Modulus (%) returns remainder | ||
if ( num%2 == 0 ) | ||
printf("%d is an even number", num); | ||
else | ||
printf("%d is an odd number", num); | ||
|
||
return 0; | ||
} |