-
Notifications
You must be signed in to change notification settings - Fork 3
/
arey-calculater.c
54 lines (50 loc) · 910 Bytes
/
arey-calculater.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
#include<stdio.h>
int main()
{
int a[5],b[5],i;
char x;
printf("select a opperaction form +,-,* and / :- ");
scanf("%c",&x);
printf("Enter first array :\n");
for (i = 0; i < 5; i++)
{
printf("Enter a number : ");
scanf("%d",&a[i]);
}
printf("\nEnter secand array :\n");
for (i = 0; i < 5; i++)
{
printf("Enter a number : ");
scanf("%d",&b[i]);
}
switch(x)
{
case '+':
{
for (i = 0; i < 5; i++)
printf("%d \n",a[i]+b[i]);
break;
}
case '-':
{
for (i = 0; i < 5; i++)
printf("%d \n",a[i]-b[i]);
break;
}
case '*':
{
for (i = 0; i < 5; i++)
printf("%d \n",a[i]*b[i]);
break;
}
case '/' :
{
for (i = 0; i < 5; i++)
printf("%.2f \n",(float)a[i]/b[i]);
break;
}
default:
printf("invalid slection \n");
}
return 0;
}