C Program Celsius to Fahrenheit

This C program is for the conversion of Fahrenheit to Celsius and reverse. This is a part of Mumbai University MCA Colleges C programs MCA Sem 1.

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
clrscr();
int a;
float f,c;
printf("To convert Fahrenheit into Celsius press 1\n");
printf("To convert Celsius into Fahrenheit press 2\n");
printf("Enter your choice:");
scanf("%d",&a);
switch(a)
{
case 1:
printf("Enter value in Fahrenheit:");
scanf("%f",&f);
c=(f-32)/1.8;
printf("%f Fahrenheit = %f Celsius",f,c);
break;

case 2:
printf("Enter value in Celsius:");
scanf("%f",&c);
f=(1.8*c)+32;
printf("%f Celsius = %f Fahrenheit",c,f);
break;
}
getch();
}

Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a Comment