#include<conio.h>
void main()
{
char op;
int i=1;
float c,f;
clrscr();
while(i)
{
printf("\nEnter you option\n\n1.C to F\n\n2.F to c\n\n3.Exit\n");
op=getch();
switch(op)
{
case '1':
printf("\nEnter the temperature in Centigrade\t: ");
scanf("%f",&c);
f=1.8*c+32;
printf("\n\t\t= %.2f Fahrenheit\n",f);
getch();
break;
case '2':
printf("\nEnter the temperature in Fahrenheit\t: ");
scanf("%f",&f);
c=(f-32)/1.8;
printf("\n\t\t= %.2f Centigrade\n",c);
getch();
break;
case '3':
i=0;
break;
default:
printf("Invalid option");
}
}
}
Algorithm
step 1: Start
step 2: intilize i<-1
step 3: Check whether i=1, then go to step4
else step20
step 4: Read op
step 5: Check whether op=1, then go to step6
else go to step10
step 6: Read c
step 7: Set f<-1.8*c+32
step 8: Print f
step 9: Break
step 10: Check whether op=2, then go to setp11
else go to step15
step 11: Read f
step 12: Set c<-(f-32)/1.8
step 13: Print c
step 14: break
step 15: check whether op=3,then go to step 16
else got to step18
step 16: i=0
step 17: break
step 18: print invalid option
step 19: go to step3
step 20: Stop