-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrayEvenOdd.c
More file actions
57 lines (50 loc) · 1.37 KB
/
Copy patharrayEvenOdd.c
File metadata and controls
57 lines (50 loc) · 1.37 KB
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
53
54
55
56
57
/**
* @file arrayEvenOdd.c
* 41. For each integer n in the interval [a, b] (given as input):
• If 1<=n<=9, then print the English representation of it in lowercase. That is 1 for "one", 2 for "two" and so on.
• Else if n>9 and it is an even number, then print "even".
• Else if n>9 and it is an odd number, then print "odd".
Input Format
The first line contains an integer, 5
The second line contains an integer, 11
Sample Output
five
six
seven
eight
nine
even
odd
* @author Md. Alamin (alamin5g@yahoo.com)
* 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-03-15
*
* @copyright Copyright (c) 2022
*
*/
#include <stdio.h>
#include <string.h>
void main(){
char *arr[] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
int i, start, end;
printf("Enter start size to n size: ");
scanf("%d %d", &start, &end);
for ( i = start; i <=end; i++)
{
if (i>=1 && i<=9)
{
printf("%s\n", arr[i-1]);
}else if (i>9)
{
if (end%2 == 0)
{
printf("Even\n");
break;
}else{
printf("odd");
break;
}
}
}
}