-
Notifications
You must be signed in to change notification settings - Fork 0
/
Switch case.c
53 lines (41 loc) · 1.18 KB
/
Switch case.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
#include<stdio.h>
int main()
{
int i,a,b,n,choice;
printf("1. Addition two numbers\n");
printf("2. Subtraction two numbers\n");
printf("3. Multiply two numbers\n");
printf("4. Series Display\n");
printf("========================================\n\n\n");
printf("Enter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("Enter the value of a & b: ");
scanf("%d %d",&a,&b);
printf("%d\n",a+b);
break;
case 2:
printf("Enter the value of a & b: ");
scanf("%d %d",&a,&b);
printf("%d\n",a-b);
break;
case 3:
printf("Enter the value of a & b: ");
scanf("%d %d",&a,&b);
printf("%d\n",a*b);
break;
case 4:
printf("Enter the value of N: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
printf("%d\t",i);
printf("n");
break;
default:
printf("out of value\n");
break;
}
return 0;
}