A weather analysis program uses the following array to store the temperature for each hour
of the day on each day of a week.

int temp[7][24];

Each row represents a day (0 = Sunday, 1 = Monday, etc.) and each column represents a time (0 =
midnight, 1 = 1 a.m...., 12 = noon, 13 = 1 p.m., etc.).
A) Write code to find Tuesday’s average temperature.
B) Write code to find the average weekly noon temperature.

Recommended Answers

All 7 Replies

We don't do your homework for you, you must first show us your code/progress so far.

What i have so far.. Any help?

#include <iostream>

using namespace std;


int main()
{
    int temp[7][24]; 
    int tuesday = 2, noon = 12; 
    int tuesday_total = 0, tuesday_average; 
    int noon_total=0, noon_average; 

    for (int i = 0; i<24; i++) 
    { 
        tuesday_total += temp[tuesday][i]; 
    } 
    tuesday_average = tuesday_total/24; 
    cout<<"Average for tuesday is: "<<tuesday_average<<endl;

    for (int i=0; i<7; i++)
    { 
        noon_total += temp[i][noon]; 
    } 
    noon_average = noon_total/7;

so what is your problem now

You did not initialize any values to your array. The calculations will end up with 0.

i want the coding for this question....????
read five(5) integer values values and total them using for loop.Display total as an Output of the program.
a) write the C program code for the problem?
b) Draw the flowchart to solve the problem?
This the question?

i want the coding for this question....????
read five(5) integer values values and total them using for loop.Display total as an Output of the program.
a) write the C program code for the problem?
b) Draw the flowchart to solve the problem?
This the question?

i want the coding for this question....????

Then write it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.