1) uses crt;
var a,s:real;
i,n:integer;
begin
write('Введите число А: ');
readln(a);
write('Введите число N: ');
readln(n);
s:=1;
for i:=1 to n do begin
s:=s*a;
end;
writeln('Число ',a,' в степени ',n,' равно ',s);
end.
2)uses crt;
var a,s:real;
i,n:integer;
begin
write('Введите число А: ');
readln(a);
write('Введите число N: ');
readln(n);
s:=1;
for i:=1 to n do begin
s:=s*a;
writeln(a,' в степени ',i,' равно ',s);
end;
end.
3)uses crt;
var a,s,p:real;
i,n:integer;
begin
write('Введите число А: ');
readln(a);
write('Введите число N: ');
readln(n);
s:=1;
p:=1;
write('1 + ');
for i:=1 to n do begin
s:=s*a;
p:=p+s;
if i<n then write(s,' + ');
if i=n then write(s,' = ');
end;
writeln(p);
end.
если суть задачи обменивать столбцы в зависимости от значений 3 строки, то вот, что я сварганил:
#include <iostream>
using namespace std;
struct collumn{
int a[3];
};
collumn c[4];
bool comp(collumn c1, collumn c2){
return c1.a[2] > c2.a[2];
}
void print() {
for(int i = 0; i < 3; i ++) {
for (int j = 0; j < 4; j++)
cout << c[j].a[i] << " ";
cout << "\n";
}
cout << "\n";
}
void solve(){
print();
sort(c,c+4,comp);
print();
}
signed main() {
for (int i = 0; i < 3; i++)
for (int j = 0; j < 4; j++)
cin >> c[j].a[i];
solve();
}