Advertisement
Guest User

tp1ej3

a guest
Apr 27th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.61 KB | None | 0 0
  1. { 3) Hallar para los siguientes valores de A: 2.6, 2.1, -3.2, -3.7, el resultado de:
  2.     TRUNC(A) y ROUND(A)
  3. }
  4. program tpej3;
  5. var
  6. n1,n2,n3,n4:real;
  7. begin
  8. n1:=2.6;
  9. n2:=2.1;
  10. n3:=-3.2;
  11. n4:=-3.7;
  12. writeln ();
  13. writeln (n1:10:2);  //:10:2 para que se vean 2 decimales despues de la coma
  14. writeln ('TRUNC: ',TRUNC(n1),' - ROUND: ',ROUND(n1));
  15. writeln ();
  16. writeln (n2:10:2);
  17. writeln ('TRUNC: ',TRUNC(n2),' - ROUND: ',ROUND(n2));
  18. writeln ();
  19. writeln (n3:10:2);
  20. writeln ('TRUNC: ',TRUNC(n3),' - ROUND: ',ROUND(n3));
  21. writeln (n4:10:2);
  22. writeln ('TRUNC: ',TRUNC(n4),' - ROUND: ',ROUND(n4));
  23. writeln ();
  24. readln();
  25. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement