-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunit-conversion.c
More file actions
59 lines (58 loc) · 1.85 KB
/
unit-conversion.c
File metadata and controls
59 lines (58 loc) · 1.85 KB
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
#include <stdio.h>
int main(int argc, char const *argv[])
{
char input;
float Kms_to_Miles = 0.621371;
float Inches_to_foot = 0.083333;
float Cms_to_Inches = 0.393701;
float Pounds_to_Kgs = 0.453592;
float Inches_to_Meters = 0.0254;
float first,second;
printf("Hello welcome to Digital Unit Conversion");
while (1)
{
printf("Enter Your input\n .A to quit\n 1.Kms_to_Miles\n 2.Inches_to_foot\n 3.Cms_to_Inches\n 4.Pounds_to_Kgs\n 5. Inches_to_Meters\n ");
scanf("%c", &input);
switch (input)
{
case 'a':
printf("Quitting conversion....");
goto end;
break;
case '1':
printf("Emter your quanitity in Terms of Kms\n");
second= first*Kms_to_Miles;
scanf("%f",&first);
printf("%f Kms is equal to is %f Miles\n",first,second);
break;
case '2':
printf("Emter your quanitity in Terms of Inches\n");
scanf("%f",&first);
second=first*Inches_to_foot;
printf("%f Inches is equal is to %f foot\n",first,second);
break;
case '3':
printf("Emter your quanitity in Terms of Cms\n");
scanf("%f",&first);
second=first*Cms_to_Inches;
printf("%f Cms is equal to is %f Inches\n",first,second);
break;
case '4':
printf("Emter your quanitity in Terms of pound\n");
scanf("%f",&first);
second=first*Pounds_to_Kgs;
printf("%f Pounds is equal is to %f Kgs\n",first,second);
break;
case '5':
printf("Emter your quanitity in Terms of Inches\n");
scanf("%f",&first);
second=first*Inches_to_Meters;
printf("%f Inches is equal is to %f Meters\n",first,second);
break;
default:
break;
}
}
end:
return 0;
}