Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- //Menu Based Temperature conversion
- int main()
- {
- int choise;
- float f,c,cal;
- printf("Temperature conversion menu \n");
- printf("1.fahrenheit to celsius\n");
- printf("2.celsius to fahrenheit\n");
- printf("please enter your choice: ");
- scanf("%d",&choise);
- switch(choise){
- case 1:{
- printf("enter the fahrenheit temperature: ");
- scanf("%f",&f);
- cal=(f-32)*(5/9);
- printf("the temperature in celsius is %f",cal);
- break;
- }
- case 2:{
- printf("enter the celsius temperature: ");
- scanf("%f",&c);
- cal=(c*(9/5))+32;
- printf("the temperature in fahrenheit is %f",cal);
- break ;
- }
- default:
- printf("not a correct option");}
- return 0;
- }
Add Comment
Please, Sign In to add comment