#include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
int main() {
const int ROWS = 6;
const int COLS = 6;
int temperatures[ROWS][COLS];
srand(time(0));
for (int i = 0; i < ROWS; i++)
{
for (int j = 0; j < COLS; j++)
{
temperatures[i][j] = rand() % 41 + 70;
}
}
cout << "Generated temperature readings:" << endl;
for (int i = 0; i < ROWS; i++)
{
for (int j = 0; j < COLS; j++)
{
cout << setw(4) << temperatures[i][j] << " ";
}
cout << endl;
}
cout << endl;
int oddCounts[COLS] = {0};
int evenCounts[COLS] = {0};
for (int j = 0; j < COLS; j++)
{
for (int i = 0; i < ROWS; i++)
{
if (temperatures[i][j] % 2 == 0)
{
evenCounts[j]++;
} else
{
oddCounts[j]++;
}
}
}
cout << "Odd and even temperature readings counts for each column:" << endl;
for (int j = 0; j < COLS; j++)
{
cout << "Column " << j + 1 << ": Odd --> " << oddCounts[j] << ", Even --> " << evenCounts[j] << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |