Permalink
Browse files

Alguns métodos básicos numéricos

  • Loading branch information...
1 parent c04c4c4 commit 74d56e624a217af796f658d88d5afd8f029b7b9c @andersondias committed Aug 30, 2010
Showing with 18 additions and 0 deletions.
  1. +18 −0 1_numeros.rb
View
18 1_numeros.rb 100755 → 100644
@@ -27,3 +27,21 @@
puts 5 * (12-8) + -15
puts 98 + (59872 / (13*8)) * -52
+#4 -> Métodos básicos
+
+1.to_f
+1.1.to_i
+1.9.to_i
+
+56.1.ceil
+56.4.round
+57.9.round
+57.9.floor
+
+3.even? # é par?
+3.odd? # é ímpar?
+3.zero? # é zero?
+0.zero?
+
+(1.655).abs
+(-9.98798).abs

0 comments on commit 74d56e6

Please sign in to comment.