1) var a:string; i, o: Integer; p: Real; begin readln(o); a := inttostr(o); for i := 1 to length(a) do p := p + strtoint(a[i]); if (sqr(o) = p*p*p) then writeln('true') else writeln('false'); end.
2) var a:string; i, o, p: Integer; begin readln(o); a := inttostr(o); for i := 1 to length(a) do p := p + strtoint(a[i]); if (p mod 3 = 0) then writeln('true') else writeln('false'); end.
3) var a, b, c: real; begin readln(a, b, c); if ((a = b) and (b = c)) then writeln('true') else writeln('false'); end.
#include <iostream>
#include <string>
#include <algorithm>
bool P(int value)
{
std::string left = std::to_string(value);
std::reverse(left.begin(), left.end());
std::string right = std::to_string(value);;
return left == right;
}
int main()
{
int n;
std::cin >> n;
int count = 0;
for (int i = 1; i <= n; ++i)
{
if (P(i))
{
count++;
}
}
std::cout << "Count palindrome: " << count << std::endl;
return 0;
}
var a:string;
i, o: Integer;
p: Real;
begin
readln(o);
a := inttostr(o);
for i := 1 to length(a) do
p := p + strtoint(a[i]);
if (sqr(o) = p*p*p) then writeln('true')
else writeln('false');
end.
2)
var a:string;
i, o, p: Integer;
begin
readln(o);
a := inttostr(o);
for i := 1 to length(a) do
p := p + strtoint(a[i]);
if (p mod 3 = 0) then writeln('true')
else writeln('false');
end.
3)
var a, b, c: real;
begin
readln(a, b, c);
if ((a = b) and (b = c)) then writeln('true')
else writeln('false');
end.
Всё проверено, удачи:)