Write a program to convert temperature in celsius to fahrenheit and vice versa.
Answers
maximizing one objective and at the same time minimizing it) -- provided that maximization and minization are carried out with respect to the same variables. in the presence of multiple objectives there is one accepted optimality cncept - that of Pareto optimality (a.k.a. efficiency).
Answer: When using C language
#include <stdio.h>
int main()
{
// declaring var
float fh1,fh2;
float cl1,cl2;
//celsius to fahrenheit
printf("Converting Celsius to Fahrenheit ");
printf("\n\nEnter temperature in Celsius: ");
scanf("%f", &cl1);
//celsius to fahrenheit conversion formula
fh1 = (cl1 * 9 / 5) + 32;
printf("%.2f Celsius = %.2f Fahrenheit", cl1, fh1 );
//fahrenheit to celsius
printf("\nConverting Fahrenheit to Celsius \n\n");
printf("\nEnter temperature in Fahrenheit : ");
scanf("%f", &fh2);
//fahrenheit to celsius conversion formula
cl2 = ((fh2 - 32) * 5/9);
printf("\n%.2f Fahrenheit = %.2f Celsius ", fh2, cl2);
return 0;
}
Explanation: