Txerrinko

Numero octal

Aug 29th, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.36 KB | None | 0 0
  1. PROGRAM numeroctal;
  2.  
  3. CONST
  4.  
  5. base= 8;
  6.  
  7. VAR
  8.  
  9. entrada: integer;
  10. a , b , c: integer;
  11. decimal : integer;
  12.  
  13. BEGIN
  14.  
  15. Write('Ingrese un n£mero entero: ');
  16. readln(entrada);
  17.  
  18. a:=entrada MOD 10;
  19. b:=(entrada DIV 10) MOD 10;
  20. c:=entrada DIV 100;
  21.  
  22. decimal:= c*sqr(base) + b*base + a;
  23.  
  24. writeln;
  25. writeln('Octal ',entrada,' = Decimal ',decimal);
  26. readln;
  27.  
  28. END.
Advertisement
Add Comment
Please, Sign In to add comment