forked from MohmedIkram/Hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclculator.c
80 lines (58 loc) · 1.74 KB
/
clculator.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
#include <stdio.h>
int main()
{
printf("\n********TAPABRATA GOSWAMI********\n");
int choose;
printf("\nChoose any one of them. \n\n1. Normal Calculator, 2. Percentage Calculator (1 or 2 ) = ");
scanf("%d", &choose);
if (choose == 1)
{
printf("\nThis calculator ony for Intiger Number.\n");
int a, b, sum;
char opretor;
printf("\nChoose a opretor(+,-,*,/) = ");
scanf("%s", &opretor);
printf("\nChoose your first number = ");
scanf("%d", &a);
printf("\nChoose your first number = ");
scanf("%d", &b);
switch (opretor)
{
case '+':
sum = (a + b);
printf("\nCalculation answer is = %d\n", sum);
break;
case '-':
sum = (a - b);
printf("\nCalculation answer is = %d\n", sum);
break;
case '*':
sum = (a * b);
printf("\nCalculation answer is = %d\n", sum);
break;
case '/':
sum = (a / b);
printf("\nCalculation answer is = %d\n", sum);
break;
default:
printf("Something is worng....");
break;
}
}
else if (choose == 2)
{
int first_num, secon_num;
int sum_per;
printf("your total value =");
scanf("%d", &first_num);
printf("your obtained value =");
scanf("%d", &secon_num);
sum_per = ((secon_num * 100) / first_num);
printf("Your Total percentage is = %d\n", sum_per);
}
else
{
printf("You are a fuck boy/Girl, Choose a write a number.\n");
}
return 0;
}