#include <iostream>
#include <iomanip>
#include <ctime>
#define N 5
using namespace std;
int main()
{
int A[N][N];
int i, j, sum=0, kol_vo=0;
setlocale(LC_ALL, "Russian");
srand(time(0));
cout << "Исходная матрица: " << endl;
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
A[i][j] = rand() % 21 - 10;
if (j % 2 != 0)
{
sum += A[i][j];
kol_vo++;
}
cout << setw(4) << A[i][j];
}
cout << endl;
}
cout << "Сумма элементов, стоящих в четных столбцах: " << sum << endl;
cout << "Колиечство элементов, стоящих в четных столбцах: " << kol_vo << endl;
return 0;
}
Ну вот программка на PascalABC:
program kv;
var
a,s,i:integer;
begin
readln (a);
for i:=1 to 40 do
begin
s:=sqr(a);
writeln (s);
readln (a);
end;
end.