-
Notifications
You must be signed in to change notification settings - Fork 164
/
HeightCalculator.c
67 lines (61 loc) · 1.16 KB
/
HeightCalculator.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
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
//height Calculator in c
void hicm()
{
float no,nocov;
printf("Enter your height :");
scanf("%f", &no);
nocov=no/30.48;
printf("\nYour height in feet is %f",nocov);
}
void hift()
{
float no,nocov;
printf("Enter your height :");
scanf("%f", &no);
nocov=no*30.48;
printf("\nYour height in cm is %f",nocov);
}
void yes()
{
printf("1) From cm to feet \n2) For feet to cm\n3) Exit");
}
void no()
{
printf("No Problem");
}
int main()
{
int ch,ch1;
printf("Do you want to know your height ?\n");
printf("1) From cm to feet \n2) For feet to cm \n3) Exit");
while(1)
{
printf("\nEnter your choice: ");
scanf("%d",&ch);
switch(ch)
{
case 1:hicm();
break;
case 2:hift();
break;
case 3:exit(0);
default:printf("Invalid Choice\n");
}
printf("\nDo you want to print menu (0/1)");
printf("\nType.... \n");
scanf("%d",&ch1);
switch(ch1)
{
case 0:yes();
break;
case 1:no();
exit(0);
break;
default:printf("Incorrect Value");
}
}
return 0;
}