C Program to convert Centigrade to Fahrenheit and vice-versa
#include<stdio.h>
void main()
{
float cent,fahr;
printf("Enter temperature in centigrade: ");
scanf("%f",¢);
fahr = 9.0/5.0 * cent + 32.0;
printf("Fahrenheit equivalent is %.1f\n",fahr);
printf("\nEnter temperature in fahrenheit: ");
scanf("%f",&fahr);
cent = 5.0/9.0 * (fahr-32.0);
printf("Centigrade equivalent is %.1f\n",cent);
return 0;
}
#include<stdio.h>
void main()
{
float cent,fahr;
printf("Enter temperature in centigrade: ");
scanf("%f",¢);
fahr = 9.0/5.0 * cent + 32.0;
printf("Fahrenheit equivalent is %.1f\n",fahr);
printf("\nEnter temperature in fahrenheit: ");
scanf("%f",&fahr);
cent = 5.0/9.0 * (fahr-32.0);
printf("Centigrade equivalent is %.1f\n",cent);
return 0;
}
0 Comments