в первом вводе вводятся количество строк и столбцов
#include <iostream>
using namespace std;
int main() {
int colss,rowss;
cin >> cols >> rows;
int a[cols][rows];
for(int i = 0; i<cols; i++){
for(int j = 0; j<rows; j++){
cin >> a[i][j];
}
}
int b[rows][cols];
for(int i = 0; i<rows; i++){
for(int j = 0; j<cols; j++){
b[i][j] = a[j][i];
}
}
for(int i = 0; i<cols; i++){
for(int j = 0; j<rows; j++){
cout << b[i][j] << " ";
}
cout << endl;
}
return 0;
}
signed main(){
int n, m;
cin >> n >> m;
vector<vector<int>> a(n, vector<int> (m));
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
cin >> a[i][j];
int col = 0, mx = a[0][0];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(a[i][j] > mx){
mx = a[i][j];
col = j;
}
}
}
for(int i = 0; i < n; i++)
swap(a[i][0], a[i][col]);
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++)
cout << a[i][j] << " ";
cout << "\n";
}
}
var s,i:integer;
begin
s:=0;
for i:=10 to 99 do
if i mod 2=1 then s:=s+i;
writeln('s = ',s);
end.
Результат:
s = 2475
2. Без использования стандартных функций:
var n,p,i:integer;
begin
readln(n);
p:=1;
for i:=1 to 5 do p:=p*n;
writeln(n,'^5 = ',p);
end.
Пример:
2
2^5 = 32
3.
var n,i:integer;
begin
readln(n);
i:=1;
while i*i<n do
begin
writeln(i,' (',i,'^2 = ',i*i,')');
i:=i+1;
end;
end.
Пример:
30
1 (1^2 = 1)
2 (2^2 = 4)
3 (3^2 = 9)
4 (4^2 = 16)
5 (5^2 = 25)