-
Notifications
You must be signed in to change notification settings - Fork 1
/
calculator_drax.c
43 lines (43 loc) · 936 Bytes
/
calculator_drax.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
#include <stdio.h>
#include <stdlib.h>
int main()
{
int no,no1,choice;
printf("Enter the number:");
scanf("%d",&no);
printf("Enter the other number:");
scanf("%d",&no1);
printf("1.ADD\n");
printf("2.SUBSTRACT\n");
printf("3.DIVIDE\n");
printf("4.MULTIPLY\n");
printf("5.Exit the calculator\n");
printf("Enter the choice:");
scanf("%d",&choice);
printf("Result: ");
switch(choice)
{
case 1:
printf("%d\n",no+no1);
break;
case 2:
printf("%d\n",no-no1);
break;
case 3:
printf("%d\n",no/no1);
break;
case 4:
printf("%d\n",no*no1);
break;
case 5:
printf("\n\nPlease wait...\n\nExitted successfully");
exit(0);
break;
default:
printf("INVALID CHOICE!\n");
printf("ENTER AGAIN\n");
main();
}
main();
return 0;
}