Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main ()
- {
- int cases;
- float a;
- float c;
- printf("\n CONVERSION \n");
- printf("\n \n FEET to INCHES = 1 \n INCHES to FEET = 2\n INCHES to CM = 3\n CM to INCHES =4\n CELSIUS to FAHRENHEIT =5\n FAHRENHEIT to CELSIUS =6\n");
- scanf("%d", &cases);
- printf("\n INPUT NUMBER: ");
- scanf("%f", &a);
- if (cases==1)//feet to inches
- {
- c = a * 12;
- printf(" %.2f feet = %.2f inches", a,c);
- }
- else if(cases==2)//inches to feet
- {
- c = a * 0.83333;
- printf(" %.2f inches = %.2f feet", a,c);
- }
- else if(cases==3)//feet to centimeters
- {
- c = a / 0.39370;
- printf(" %.2f feet = %.2f centimeters", a,c);
- }
- else if (cases==4)//centimeters to inches
- {
- c = a * 0.39370;
- printf(" %.2f centimeters = %.2f inches", a,c);
- }
- else if (cases==5)//celsius to fahrenheit
- {
- c = a * 1.8000 + 32.00;
- printf(" %.2f celsius = %.2f fahrenheit", a,c);
- }
- else if (cases==6)// fahrenheit to celsius
- {
- c = a - 32 / 1.8000;
- printf(" %.2f fahrenheit = %.2f celsius", a,c);
- }
- else
- {
- printf(" I N V A L I D ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement