Localize file www.TrSek.com/zadania/cyklus.pas{ CYKLUS.PAS }
{ Vypocet suctu ciselneho radu 1..N }
{ }
{ Author: Juraj Pupak }
{ Date : 27.10.2006 http://www.trsek.com }
program Cyklus;
uses crt;
var
i,sucet,n,k: integer;
begin
clrscr;
writeln('Vypocet ciselneho radu 1..n');
writeln('---------------------------');
writeln('Zadaj cislo');
readln(n);
clrscr;
For i := 1 to n do
begin
k := i;
sucet:= sucet + i;
IF i > 14 THEN
begin
k := k mod 15 + 1;
write(i);
end;
IF i = n THEN
begin
textcolor(7);
write(k);
textcolor(k);
write('=');
end
else
begin
textcolor(7);
write(k);
textcolor(k);
write('+');
end;
end;