Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Program project1;
  2.  
  3. procedure Vbin(n:qword; var a:string);
  4. begin
  5. a:='';
  6. repeat
  7. until(n > 0);
  8. while n > 0 do begin
  9. if n mod 2 = 0 then
  10. a:= '0'+a
  11. else begin
  12. a:= '1'+a;
  13. n:= n - 1;
  14. end;
  15. n:= n div 2;
  16. end;
  17. end;
  18.  
  19.  
  20. Var
  21. a,b,last:qword;
  22. s:string;
  23.  
  24. begin
  25. readln(a);
  26. Vbin(a,s);
  27. writeln(s);
  28. b:=0;
  29. while (a<>0) do
  30. begin
  31. last:= a mod 2;
  32. a:= a shr 1;
  33. b:=b shl 1 + last;
  34. end;
  35. Vbin (b,s);
  36. writeln(s);
  37. writeln(b);
  38. readln();
  39. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement