#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int number, coun = 0, d, first, last;
double pwr;
setlocale(LC_ALL, "Russian");
cout << "Поменять первую и последнюю цифры числа>" << endl;
cout << "Введите число: ";
cin >> number;
d = number;
while (d > 0)
{
d /= 10;
coun++;
cout << "count = " << coun << endl;
}
pwr = pow(10, coun-1);
//к примеру число равно 321
//first = 3
//last = 1
//number = 32
//number = 323
//number = 23
//number = 123
first = number / (int)pwr;
last = number % 10;
number /= 10;
number = number * 10 + first;
number %= int(pwr);
number += last * int(pwr);
cout << "Result: " << number << endl;
return 0;
}
var A: array [1..10] of integer;
I,S: integer;
min:=a[1];
beginfor I:=1 to 10 do
begin
a[i]:=random(10);
S:=S+A[I];
write(a[i],' ');
end;
for i:=2 to 10 do
begin
if min>a[i] then
min:=a[i];
end;
writeln;
writeln ('сумма=',S);
writeln ('минимальное=',min);
end.