Write a program in c to convert temperature from fahrenheit to celsius and vice versa
Answers
Answered by
14
//C program to convert Celsius to Fahrenheit
#include <stdio.h> int main(){ float celsius, fahrenheit; printf("Please Enter temperature in Celsius: \n"); scanf("%f", &celsius); // Convert the temperature from celsius to fahrenheit fahrenheit = ((celsius * 9)/5) + 32; // fahrenheit = ((9/5) * celsius) + 32; // fahrenheit = ((1.8 * celsius) + 32; printf("\n %.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit); return 0;}
#include <stdio.h> int main(){ float celsius, fahrenheit; printf("Please Enter temperature in Celsius: \n"); scanf("%f", &celsius); // Convert the temperature from celsius to fahrenheit fahrenheit = ((celsius * 9)/5) + 32; // fahrenheit = ((9/5) * celsius) + 32; // fahrenheit = ((1.8 * celsius) + 32; printf("\n %.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit); return 0;}
Similar questions