Begin var a: integer; readln(a); for i: integer := 1 to abs(a) do if (a mod i = 0) then writeln('> ', i); end.
function Simple(a: integer): boolean; begin result := true; for i: integer := 2 to (a div 2) do if (a mod i = 0) then begin result := false; break; end; end;
begin var a: integer; readln(a); writeln(Simple(a)); end.
var a: integer;
begin readln(a); for i: byte := length(a.ToString()) downto 1 do write(a.ToString()[i]); end.
function Simple(a: integer): boolean; begin result := true; for i: integer := 2 to (a div 2) do if (a mod i = 0) then begin result := false; break; end; end;
function par(a: integer): string; begin for i: byte := length(a.ToString()) downto 1 do result += a.ToString()[i]; end;
begin var a: integer; readln(a); for i: integer := 1 to abs(a) do if ((a mod i = 0) and (Simple(a)) and (par(a) = inttostr(i))) then writeln('> ', i); end.
var a: integer;
readln(a);
for i: integer := 1 to abs(a) do
if (a mod i = 0) then
writeln('> ', i);
end.
function Simple(a: integer): boolean;
begin
result := true;
for i: integer := 2 to (a div 2) do
if (a mod i = 0) then
begin
result := false;
break;
end;
end;
begin
var a: integer;
readln(a);
writeln(Simple(a));
end.
var
a: integer;
begin
readln(a);
for i: byte := length(a.ToString()) downto 1 do
write(a.ToString()[i]);
end.
function Simple(a: integer): boolean;
begin
result := true;
for i: integer := 2 to (a div 2) do
if (a mod i = 0) then
begin
result := false;
break;
end;
end;
function par(a: integer): string;
begin
for i: byte := length(a.ToString()) downto 1 do
result += a.ToString()[i];
end;
begin
var a: integer;
readln(a);
for i: integer := 1 to abs(a) do
if ((a mod i = 0) and (Simple(a)) and (par(a) = inttostr(i))) then
writeln('> ', i);
end.
using System;
class Program
{
private static int GetThird(int num)
{
var result = 0;
var kv = num * num;
if (num % 2 == 0)
{
for (var i = num / 2; i > 0; i--)
{
result += kv - i * 2 + 1;
}
for (var i = 0; i < num / 2; i++)
{
result += kv + i * 2 + 1;
}
}
else
{
for (var i = (num - 1) / 2; i > 0; i--)
{
result += kv - i * 2;
}
result += kv;
for (var i = 0; i < (num - 1) / 2; i++)
{
result += kv + i * 2 + 2;
}
}
return result;
}
//оптимизированное свое решение, коротко и ясно
private static int GetThirdOptimized(int num)
{
var result = 0;
var kv = num * num - num + 1;
for (var i = 0; i < num; i++)
{
result += kv + i * 2;
}
return result;
}
private static void Main()
{
Console.WriteLine("Введите натуральноe числo ");
var i = int.Parse(Console.ReadLine());
Console.WriteLine("{0}^3 = {1} = {2} = {3}", i, i * i * i, GetThird(i), GetThirdOptimized(i));
Console.Read();
}
}