Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Temperature Program in C I have some code I\'ve done at the bottom. 12 Month Tem

ID: 3556718 • Letter: T

Question

Temperature Program in C

I have some code I've done at the bottom.

12 Month Temperature Program in C

Write a program that accepts inputs from a user. The user indicates the month of the
year. The program then reads 2 temperature samples for that month. If the
temperature is above record high or record low, then the program must indicate it as
a new record. The program must also identify the category the temperature falls into.
For example, for January, the following categories apply:

a. Record high: temp >= 65
b. Average high: 43.5 <= temp <= 64.9
c. Average low: 17.5 <= temp <= 43.4
d. Low: -14 <= temp <= 17.4
e. Record low: temp < -14

Finally, the program must identify the season (assume that winter is composed of
December, January and February; Spring of March, April and May; Summer of June,
July, and August; and Fall of September, October, an November). Once the season is
identified, the program computes the average of the 2 temperatures and indicates weather
that average is above, below, or the same of the season average. The average of a month
is the average of

Explanation / Answer

#include<stdio.h>
int main()
{
int fahr,cel,choice;

printf("What do you want to do?(1/2) 1. fahrenheit to Celsius 2. Celsius to Fahrenheit ");
scanf("%d",&choice);

switch(choice)
{
case 1:
printf("Enter fahrenheit value ");
scanf("%d",&fahr);
cel=(fahr-32)*5/9;
printf("Celsius of %d degrees fahrenheit is %d degrees celsius ",fahr,cel);

case 2:
printf("Enter fahrenheit value ");
scanf("%d",&cel);
fahr=cel*5/9 + 32;
printf("Fahrenheit of %d degrees Celsius is %d degrees fahrenheit ",cel,fahr);
}
}

OR (same program replacing the switch with if statements)


#include<stdio.h>
int main()
{
int fahr,cel,choice;

printf("What do you want to do?(1/2) 1. fahrenheit to Celsius 2. Celsius to Fahrenheit ");
scanf("%d",&choice);


if(choice==1)
{
printf("Enter fahrenheit value ");
scanf("%d",&fahr);
cel=(fahr-32)*5/9;
printf("Celsius of %d degrees fahrenheit is %d degrees celsius ",fahr,cel);

}

if(choice==2)
{
printf("Enter fahrenheit value ");
scanf("%d",&cel);
fahr=cel*5/9 + 32;
printf("Fahrenheit of %d degrees Celsius is %d degrees fahrenheit ",cel,fahr);
}

}

OR THIS :

#include<stdio.h>

main ()
{
float temp_c, temp_f;

printf ("Enter the value of Temperature in Celcius: ");

scanf ("%f", &temp_c);

temp_f = (1.8 * temp_c) + 32;

printf ("The value of Temperature in Fahreinheit is: %f", temp_f);

}

Please Rate

Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote