1. A. CONVERT DEGREES INTO FAHRENHEIT AND VICE VERSA
SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main(){
float cel,fahr;
int d;
clrscr();
while(1){
printf("\nEnter the Choice\n");
printf("\n1.Degree to Fahrenheit\n2.Fahrenheit to
Degree\n3.Exit\n");
scanf("%d",&d);
switch(d){
case 1:
printf("\nEnter temp in Celsius : ");
scanf("%f",&cel);
fahr = (1.8 * cel) + 32;
printf("\nTemperature in Fahrenheit : %f ",fahr);
break;
case 2:
printf("\nEnter temp in Fahrenheit : ");
scanf("%f",&fahr);
cel = (100.0 / 180.0) * (fahr - 32);
printf("\nTemperature in Degree : %f ",cel);
break;
case 3:
exit(0);
}
}
}
0 comments:
Post a Comment