-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram6.c.c
52 lines (43 loc) · 1.34 KB
/
Program6.c.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//Write a program which checks whether number is even or odd.
#include<stdio.h> //for printf and scanf
#include<stdbool.h> //for bool data type or(typedef)
/////////////////////////////////////////////////////////////////////////
// Funtion name: CheckEvenOdd
// Input: Integer
// Output: Boolean
// Description: Checks whether input is even or odd
// Author: Shruti Vaibhav Bartakke
// Date: 25/04/2023
// Update Date:
////////////////////////////////////////////////////////////////////////
bool CheckEvenOdd(int iNo) //checkEvenOdd() in java
{
if((iNo % 2) == 0)
{
return true;
}
else
{
return false;
}
}
//////////////////////////////////////////////////////////////////////////
//Entry point function
/////////////////////////////////////////////////////////////////////////
int main()
{
int iValue = 0; //local var to acccept input
bool bRet = false; //var to accept return value
printf("Please enter number to check whether it is even or odd: \n");
scanf("%d",&iValue);
bRet = CheckEvenOdd(iValue); //function call
if(bRet == true)
{
printf("%d is Even number\n",iValue);
}
else
{
printf("%d is Odd number\n",iValue);
}
return 0;
}