Wednesday, 9 March 2016

C Program For Temperature Conversion Celcius To Fehrenheit And Vice Versa Using Switch Case

#include
#include
main()
{
//Ghanendra Yadav
float a,b,centigrade, fahrenheit;
int x;
printf("Press 1:Fahrenheit To Centigrade\nPress 2:Centigrade to Fahrenheit\n");
scanf("%d",&x);
switch(x)
{
case 1:

printf("\nEnter the value of Fahrenheit Temperature:");
scanf("%f",&a);
centigrade=5*(a-32)/9;
printf("Centigrade Temperature:%f\n",centigrade);
break;
case 2:

printf("\nEnter the value of Centigrade Temperature:");
scanf("%f",&b);
fahrenheit=((9*b)/5)+32;
printf("Fahrenheit Temperature:%f\n",fahrenheit);
break;
default:
printf("wrong Input");
}
getch();
return(0);
}

Output:-


No comments:
Write comments

Recommended Posts × +