-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWAP to create menu for following operators : a. Arithmetic operator b. Modulo operator c. Relational operator d. Logical operator (switch case)
110 lines (84 loc) · 2.34 KB
/
WAP to create menu for following operators : a. Arithmetic operator b. Modulo operator c. Relational operator d. Logical operator (switch case)
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
105
106
107
108
109
110
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,choice;
printf("\n 1 arthemetic operater ");
printf("\n 2 modulo operater ");
printf("\n 3 relational operater ");
printf("\n 4 logical operater ");
printf("\n select an option :");
scanf("%d",&choice);
switch (choice)
{
case 1 : printf("enter the value of a and b is :");
scanf("%d %d",&a,&b);
c=a+b;
printf("the value of a+b is : %d",c);
break;
case 2 : printf("enter the value of a and b is :");
scanf("%d %d",&a,&b);
c=a%b;
printf("the value of a%b is : %d",c);
break;
case 3 : printf("two no. is a and b is ");
scanf("%d%d",&a,&b);
if(a>b) {
printf("\n max. = %d",a);
printf("\n min. = %d",b);}
else
{
printf("\n max. = %d",b);
printf("\n min. = %d",a);
}
break;
case 4 : int lower ,upper;
char ch;
printf("enter any character ");
scanf(" %c",&ch);
lower=(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u');
upper=(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U');
if ( lower||upper )
printf("\nit is a vowel");
else
printf("\nit is consonent");
break;
default : printf("u choose wrong ");
}
}
output 1 :
1 arthemetic operater
2 modulo operater
3 relational operater
4 logical operater
select an option :1
enter the value of a and b is :2
67
the value of a+b is : 69
output 2:
1 arthemetic operater
2 modulo operater
3 relational operater
4 logical operater
select an option :2
enter the value of a and b is :2
5
the value of ab is : 2
output 3:
1 arthemetic operater
2 modulo operater
3 relational operater
4 logical operater
select an option :3
two no. is a and b is 23
45
max. = 45
min. = 23
output 4:
1 arthemetic operater
2 modulo operater
3 relational operater
4 logical operater
select an option :4
enter any character s
it is consonent