Saturday, 26 September 2015

Program to convert tempreture in ferenite to celcius or celcius to ferenite

/*Program to convert tempreture in ferenite to celcius or celcius to ferenite*/
void main()
{
float f,c;
char ch;
clrscr();
printf("enter intial scale f or c :");
scanf("%c",&ch);
switch(ch)
{
case 'c':
case 'C':
printf("enter temp in %c",ch);
scanf("%f",&c);
f=9*c/5+32;
printf("temp in f=%f",f);
break;
case 'f':
case 'F':
printf("enter temp in %c :",ch);
scanf("%f",&f);
c=5*(f-32)/9;
printf("temp in c=%f",c);
break;
default:
printf("invalid choice of scale");
}
getch();

}

No comments:

Post a Comment