#include<iostream>
#include <cstdlib>
#include <math.h>
using namespace std;
int main()
{
system("chcp 1251 > null");
int n = 0;
cout << "Задача 1.\n\tВведіть n: ";
cin >> n;
for(int i = 1; i<=n; i++){
if(i%7==0){
cout << i;
}
}
cout << "\n\n";
int a,b;
cout << "Задача 2.\n\tВведіть перше число діапазону: ";
cin >> a;
cout <<"\n\tВведіть друге число діапазону: ";
cin >> b;
double sum = 0;
double sr = 0;
int index = 0;
for(int i = a; i<=b; i++){
sum = sum+i;
index++;
}
sr = sum / index;
cout << "\n\nСума: " << sum << "\nСереднє арифметичне: " << sr;
int x = 0;
int y = 0;
cout << "\n\nЗадача 3.\n\tВведіть x: ";
cin >> x;
cout << "\n\tВведіть y: ";
cin >> y;
cout << "Результат" << powl(x,y);
}
Старался написать как можно проще. По оценить мои старания ;-)
var
a: array[1..20, 1..20] of integer;
n, m, i, j, jm: integer;
begin
randomize;
writeln('Введите количество строк и столбцов соответственно: ');
readln(n, m);
writeln('Сгенерированная матрица: ');
for i := 1 to n do
begin
jm := 1;
for j := 1 to m do
begin
a[i, j] := random(99);
write(a[i, j]:4);
if (i mod 2 = 0) and (a[i, jm] > a[i, j])
then jm := j;
end;
if i mod 2 = 0 then write(' min=a[', i, ',', jm, ']=', a[i, jm]);
writeln;
end;
readln;
end.