-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCalculator.c
55 lines (43 loc) · 1.04 KB
/
Calculator.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
//*****************************************|
//Author:Kailean Hunter |
//File Name:Assignment 1 |
//Project: Inch / Centimeter Converter |
//Date: 2/6/2016 |
//*****************************************|
//Pre-Processors
#include <stdio.h>
#include <stdlib.h>
int main()
{
//declarations
int menu=0;
float number1 = 0, sum, inches;
//Menu
printf("Hi, Weclome to my Inch / Centimeter Converter\n");
printf("Please select your option below\n");
printf("1 - Inch to Centimeter\n");
printf("2 - Centimeter to Inch\n");
printf("Option: ");
scanf("%d", &menu);
//Math
if (menu==1)
//Inch to Centimeter
{
printf("Enter Inch to Convert\n");
printf("Inchs= ");
scanf("%f", &number1);
number1= inches;
sum= number1 * 2.54;
printf("Centimeters= %f", sum);
}
else if(menu==2)
//Centimeter to Inch
{
printf("Enter Centimeter to Convert\n");
printf("Centimeters= ");
scanf("%f", &number1);
sum= number1 / 2.54;
printf(" Inches= %f", sum);
}
return 0;
}