-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproblem-41.c
43 lines (38 loc) · 822 Bytes
/
problem-41.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
/**
* @file problem-41.c
* write a program to check even or odd number using recursive function.
* @author Md. Alamin ([email protected])
* I would love be a software engineer at Google. That is why anybody can uses this code without any condition, if you face any difficulty, then try to email me.
* @version 0.1
* @date 2022-04-05
*
* @copyright Copyright (c) 2022
*
*/
#include <stdio.h>
int evenOdd(int a);
void main()
{
int n, f;
printf("Enter a number: \n");
scanf("%d", &n);
f = evenOdd(n);
if (f==1)
{
printf("%d is even number.\n", n);
}else
{
printf("%d is not even number.\n", n);
}
}
int evenOdd(int a){
if (a == 0){
return 1;
}else if(a == 1)
{
return 0;
}else
{
return evenOdd(a-2);
}
}