Problem Statement
Write a c program to convert temperature from celsius to fahrenheit
and fahrenheit to celcius
#include<stdio.h>
int main()
{
int d;
float c,f;
printf("enter 1 for celsius to faurenhite\n");
printf("enter 2 for faurenhite to celsius\n");
scanf("%d",&d);
if(d==1)
{
printf("enter the temperature \n");
scanf("%f",&c);
f=(9*c/5)+32;
printf("the value in the faur. scale is %f \n",f);
}
else if(d==2)
{
printf("enter the temperature \n");
scanf("%f",&f);
c=((5*f)-32)/9;
printf("the vlaue of teperature in celcius scale is %f \n",c);
}
else
{
printf("no other conversionis possible \n");
}
return 0;
}
No comments:
Post a Comment