: India is a country with moderate weather. So, people here measure temperature in Celsius scale. America is country with cold weather. So, people there measure temperature in Fahrenheit scale. Some students of LPU are going for an international exposure visit to America. Since it is the first time for them, they find it very difficult to follow their temperature readings. Write a program to help them understand the American temperature readings easier, based on their Indian way of understanding. [10]
#include <stdio.h>
int main()
{
//define a variable to hold temperature
float temperature;
//get temperature in Celsius from the user
printf("\nEnter temperature in Celsius: ");
scanf("%f",&temperature);
//convert temperature from Celsius to Fahrenheit
float temperature2= (temperature * 1.8) + 32;
//display the result to the user
printf("\nThe temperature in Fahrenheit is: %0.2f ",temperature2);
return 0;
}
Sample Output
Comments
Leave a comment