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
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;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.