Sunushi

9.3, Potęgi trójki

Oct 26th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.86 KB | None | 0 0
  1. uses crt;
  2. var
  3.         trojka:byte;
  4.         liczba, potega:longint;
  5. begin
  6.         clrscr;
  7.         trojka:=3;
  8.         potega:=1;
  9.         writeln('Program wyswietla kolejne potegi liczby 3, az do uzyskania');
  10.         writeln('wartosc potegi wiekszej od podanej liczby');
  11.         writeln('Podana liczba musi byc wieksza niz 2');
  12.         writeln;
  13.         write('Podaj liczbe: ');
  14.         readln(liczba);
  15.         if liczba < 3 then
  16.                 writeln('Podana liczba jest mniejsza niz 3')
  17.         else
  18.                 begin
  19.                         repeat
  20.                                 potega:=potega*trojka;
  21.                                 write(potega);
  22.                                 if (potega <= liczba) then
  23.                                         write(', ');
  24.                         until potega > liczba;
  25.                 end;
  26.         readln;
  27. end.
Advertisement
Add Comment
Please, Sign In to add comment