//To convert the temperature between Celcius and Fahrenheit
#include<stdio.h>
#include<conio.h>
int main()
{
float c,f;
int m;
clrscr();
printf("Enter your choice"
"\nPress 1 to convert Temperature from Celcius to Fahrenheit"
"\nPress 2 to convert Temperature from Fahrenheit to Celcius\n");
scanf("%d",&m);
switch(m)
{
case 1:
printf("\nEnter the Temperature in Celcius\n");
scanf("%f",&c);
f=9*c/(5)+32;
printf("\nTemperature in Fahrenheit is = %f",f);
break;
case 2:
printf("\nEnter the Temperature in Fahrenheit\n");
scanf("%f",&f);
c=(f-32)*5/9;
printf("\nTemperature in Celcius is = %f",c);
break;
default:
printf("\nEnter valid Choice");
}
getch();
return 0;
}
#include<stdio.h>
#include<conio.h>
int main()
{
float c,f;
int m;
clrscr();
printf("Enter your choice"
"\nPress 1 to convert Temperature from Celcius to Fahrenheit"
"\nPress 2 to convert Temperature from Fahrenheit to Celcius\n");
scanf("%d",&m);
switch(m)
{
case 1:
printf("\nEnter the Temperature in Celcius\n");
scanf("%f",&c);
f=9*c/(5)+32;
printf("\nTemperature in Fahrenheit is = %f",f);
break;
case 2:
printf("\nEnter the Temperature in Fahrenheit\n");
scanf("%f",&f);
c=(f-32)*5/9;
printf("\nTemperature in Celcius is = %f",c);
break;
default:
printf("\nEnter valid Choice");
}
getch();
return 0;
}
No comments:
Post a Comment