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

write the following as a C program Programming problem: This program is a modifi

ID: 3575054 • Letter: W

Question

write the following as a C program



Programming problem: This program is a modification of Assignment #6. This program still enters temperatures for each date, but then after data entry, it prints one table of all of the data 1. Declare all variables. Both of the temperatures must be declared as one dimensional arrays (e.o tempF132l & tempC1321). Since arrays start at 0 the size of these arrays must be declared as 32. 2. Asks user to enter a month number and a year Uust like #6) 3. Program determines the number of days in the month, which is then the maximum number of times the program asks for the day's temperature Gust like #6). You may use shortened months not all shortened to same, such as 11 days in place of 31 10 in place of 30, 8 in place of 28. 4. The user is asked to enter the temperature for each day of the month (with date given... e g. for 2/1/2015) within a program loop. Within the loop: a. Store the temperature for each day of the month (using an array like tempFlcount). 5. Prints out a heading for the table (Date Temp in F Temp in C) 6. Prints out one table of the data for each day including date, temperature in F, and temperature in C as shown in the example below for the month of February 2015. Temp in Fahrenheit Temp in Celsius 2/1/2015 70 2/2/2015

Explanation / Answer

#include <stdio.h>

#include<conio.h>

int main()

{

int tempF[32],tempC[32];

int month,year,days;

//read month and year

printf("Enter month ");

scanf("%d", &month);

printf("Enter year ");

scanf("%d", &year);

// define the number of days according to month

if(month<8){

if(month%2==0 ){

if(month==2){

days=28;

}

else{ days=30;}

}

else{

days=31;

}

}

else {

if(month%2==0 ){

days=31;

}

else{

days=30;

}

}

//read the temprature in fahrenhit and it in the array tempF[]

//and also convert it in celsius, and store in array tempC[]

for(int i=1;i<=days;i++)

{

printf("Enter temperature for day %d",i);

scanf("%d", &tempF[i]);

tempC[i]=(tempF[i]-32)/1.8;

printf(" ");

}

//print the table

// is used for tab

printf("Date Temp in F Temp in C");

for(int j=1;j<=days;j++)

{

printf("%d/%d/%d %d %d", month,j,year, tempF[i], tempC[i]);

printf(" ");

}

return 0;

}