Converting Celsius to Fahrenheit and Fahrenheit to Celsius
#include <stdio.h>
int main() {
float c,f;
int x;
//press 1 if u want temperature in celsius
//press 2 if u want temperature in fahrenheit
printf("Enter your choice 1 || 2 \n");
scanf("%d",&x);
switch(x)
{
case 1:
printf("Enter the value of temperature in farenheit\n");
scanf("%f",&f);
c=f-32;
printf("The value of temperature in celsius is %1.f",c/9);
break;
case 2:
printf("enter the value of temperature in celsius\n");
scanf("%f",&c);
f= 9*c;
printf("The value of temperature in fahrenheit is %1.f",f+32);
break;
return 0;
}
}
int main() {
float c,f;
int x;
//press 1 if u want temperature in celsius
//press 2 if u want temperature in fahrenheit
printf("Enter your choice 1 || 2 \n");
scanf("%d",&x);
switch(x)
{
case 1:
printf("Enter the value of temperature in farenheit\n");
scanf("%f",&f);
c=f-32;
printf("The value of temperature in celsius is %1.f",c/9);
break;
case 2:
printf("enter the value of temperature in celsius\n");
scanf("%f",&c);
f= 9*c;
printf("The value of temperature in fahrenheit is %1.f",f+32);
break;
return 0;
}
}
Comments
Post a Comment