initial commit
This commit is contained in:
26
C++/lesson3/task4.cpp
Normal file
26
C++/lesson3/task4.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
std::cin >> n;
|
||||
int a[n][n];
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < n; j++) {
|
||||
a[i][j] = i * j;
|
||||
std::cout << a[i][j] << " ";
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
int s = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j < n; j++) {
|
||||
s += a[i][j];
|
||||
}
|
||||
int avg = s / n;
|
||||
std::cout << avg << "\n";
|
||||
s = 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user