program to : 1. Ask the user to enter the temperature for a given day. 2. Based on the temperature entered by the user display the corresponding weather condition for that given day. A program to display the weather
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Write a C program to :
1. Ask the user to enter the temperature for a given day.
2. Based on the temperature entered by the user display the corresponding weather condition for that given day.
A program to display the weather condition based on the input temperatureas following if
temp<= -10 == very cold
if temp<= 5 == cold
if temp<= 15 == cool
if temp<= 25 == mild
if temp<= 35 == Hot
if temp> 35 == very hot
int main() { float temperature; printf("Enter an temperature: "); scanf("%f", &temperature); printf("%f",temperature); if(temperature<=-10){ printf(" very cold"); } else if(temperature<=5){ printf(" cold"); } else if(temperature<=15){ printf(" cool"); } else if(temperature<=25){ printf(" mild"); } else if(temperature<=35){ printf(" hot"); } else{ printf(" very hot"); } return 0; } |
Step by step
Solved in 2 steps with 5 images