#include<stdio.h>
#include<conio.h>
void main()
{
double temp,ctemp;
int ch;
clrscr();
printf("\n Select your choice ");
printf("\n\t1.Fahrenheit to Celsius");
printf("\n\t2.Celsius to Fahrenheit");
printf("\n Enter your choice(1/2) : ");
scanf("%d",&ch);
if(ch==1)
{
printf("\n Enter Temperature in Fahrenheit : ");
scanf("%lf",&temp);
ctemp=(temp-32)/1.8;
printf("\n Temprature in celcius is : %lf",ctemp);
}
else
if(ch==2)
{
printf("\n Enter Temperature in Celsius : ");
scanf("%lf",&temp);
ctemp=(1.8*temp)+32;
printf("\n Temperature in Fahrenheit is : %lf",ctemp);
}
else
printf("\n Wrong choice.....!!");
getch();
}
Output

#include<conio.h>
void main()
{
double temp,ctemp;
int ch;
clrscr();
printf("\n Select your choice ");
printf("\n\t1.Fahrenheit to Celsius");
printf("\n\t2.Celsius to Fahrenheit");
printf("\n Enter your choice(1/2) : ");
scanf("%d",&ch);
if(ch==1)
{
printf("\n Enter Temperature in Fahrenheit : ");
scanf("%lf",&temp);
ctemp=(temp-32)/1.8;
printf("\n Temprature in celcius is : %lf",ctemp);
}
else
if(ch==2)
{
printf("\n Enter Temperature in Celsius : ");
scanf("%lf",&temp);
ctemp=(1.8*temp)+32;
printf("\n Temperature in Fahrenheit is : %lf",ctemp);
}
else
printf("\n Wrong choice.....!!");
getch();
}
Output
No comments:
Post a Comment