-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch3.c
104 lines (85 loc) · 2.08 KB
/
switch3.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// write a programe to print number in words using switch case only 2 digit number
// => 12 - > One two
// 74 - > seven four
#include<stdio.h>
void main()
{
int number,first,second;
printf("Enter value of number any digit number only ");
scanf("%d",&number);
if(number<10 && number>99)
{
printf("Please enter only 2 digit number ");
}
else
{
first = number / 10;// 7
second = number % 10; //4
switch(first)
{
case 1:
printf("One ");
break;
case 2:
printf("Two ");
break;
case 3:
printf("Three ");
break;
case 4:
printf("Four ");
break;
case 5:
printf("Five ");
break;
case 6:
printf("Six ");
break;
case 7:
printf("Seven ");
break;
case 8:
printf("Eight ");
break;
case 9:
printf("Nine ");
break;
case 0:
printf("Zero ");
break;
}
switch(second)
{
case 1:
printf("One ");
break;
case 2:
printf("Two ");
break;
case 3:
printf("Three ");
break;
case 4:
printf("Four ");
break;
case 5:
printf("Five ");
break;
case 6:
printf("Six ");
break;
case 7:
printf("Seven ");
break;
case 8:
printf("Eight ");
break;
case 9:
printf("Nine ");
break;
case 0:
printf("Zero ");
break;
}
}
}