Write a program in C that will convert all 12 months average

Write a program in C that will convert all 12 months\' average temperature from Celsius to Fahrenheit. You need to create an array named aye jump and prompt the user to input average temperature in Celsius for all 12 months. After that, you need to develop a user temperatures from Celsius to Fahrenheit and pass the array as reference and convert all temperatures from Celsius to Fahrenheit. Next, compute the average temperature of the year and assign it to a pointer variable. Finally, you return the array and from the main function, print the array along with month and yearly average. You can use loadArray and printArray functions. -Comments & Indentation. -Implement the program.

Solution

ANS:

#include<stdio.h>
void celsiusToFahrenheit(double avgTemp[],double fa[]);
int main()
{
double avgTemp[12]; //to store monthly temp
double fa_avg;//to store yearly average temp
double sum=0 ;
double fa[12];//to store average of fahrenheit temps
int i;
for(i=0;i<12;i++)//to read 12 months average temp
{
printf(\"\ Enter average Temp of month%d in celsius: \",i+1);
scanf(\"%lf\",&avgTemp[i]);
}
celsiusToFahrenheit(avgTemp,fa); //to convert celsius to fahrenheit
for(i=0;i<12;i++){
sum=sum + fa[i];
}
fa_avg=sum/12;
printf(\"\ Monthly average Temp: \ \");
for(i=0;i<12;i++)
printf(\"Month%d average= %lf\ \",i+1, fa[i]);
printf(\"Yearly Average=%lf\",fa_avg);
return 0;
}
void celsiusToFahrenheit(double avgTemp[],double fa[])
{

int i;
for(i=0;i<12;i++) {
fa[i]=(1.8*avgTemp[i])+32;

}
}

 Write a program in C that will convert all 12 months\' average temperature from Celsius to Fahrenheit. You need to create an array named aye jump and prompt th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site