Advertisement
EWTD

dz1

Sep 14th, 2017
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.43 KB | None | 0 0
  1. program lol;
  2.  
  3. uses crt;
  4. var
  5.   x, y, k, j,b: integer;
  6.  
  7. function pow(x,y: integer): integer;
  8. var
  9. s,k:integer;
  10. begin
  11.   s := x;
  12.   for k := 1 to (y-1) do
  13.     s := s * x;
  14.     if y = 0 then
  15.     result:=1
  16.     else
  17.   result := s;
  18. end;
  19.  
  20. begin
  21.   clrscr;
  22.   readln(x, y);
  23.   b := 0;
  24.   j := 0;
  25.   k := 0;
  26.   while x > 0 do
  27.   begin;
  28.     b := b + (x mod 10) * pow(y, j);
  29.     x := x div 10;
  30.     j := j + 1;
  31.   end;
  32.   writeln(b);
  33. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement