Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Square-but-not-cube/Delphi/square-but-not-cube.delphi
Normal file
27
Task/Square-but-not-cube/Delphi/square-but-not-cube.delphi
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
program Square_but_not_cube;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
System.Math;
|
||||
|
||||
begin
|
||||
var count := 0;
|
||||
var n := 1;
|
||||
while count < 30 do
|
||||
begin
|
||||
var sq := n * n;
|
||||
var cr := Trunc(Power(sq, 1 / 3));
|
||||
if cr * cr * cr <> sq then
|
||||
begin
|
||||
inc(count);
|
||||
writeln(sq);
|
||||
end
|
||||
else
|
||||
Writeln(sq, ' is square and cube');
|
||||
inc(n);
|
||||
end;
|
||||
|
||||
{$IFNDEF UNIX} readln; {$ENDIF}
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue