Created
December 18, 2012 20:34
-
-
Save lrlucena/4331720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Questao 1 | |
"Programacao de Computadores".size | |
# ou | |
"Programacao de Computadores".length | |
# Questao 2 | |
media = (8.12 + 7.45) / 2.0 | |
"A sua media foi de "+ media.to_s + " este ano!" | |
# ou como será visto mais adiante ... | |
"A sua media foi de #{media} este ano!" | |
# Questao 3 | |
media = (9.23 + 8.32) / 2.0 | |
media.to_s.size | |
# Questao 4 | |
x = 10 * 1.1 | |
x.class | |
# Questao 5 | |
x = "10" | |
y = x + 1 | |
y.class | |
# Questao 6 | |
x="Profs"*3 | |
x.class | |
# Questao 7 | |
y = "10 bananas".to_i*5 + "abacaxi".to_f | |
y | |
y.class | |
# Questao 8 | |
exp = (10.0/3.1).to_i | |
exp.class | |
# Questao 9 | |
item1 = "6 ovos" | |
item2 = "1 quilo de farinha" | |
item3 = "1 litro de leite" | |
item4 = "2 tabletes de manteiga" | |
item5 = "3 xicaras de acucar" | |
quantidade = item1.to_i + item2.to_i + item3.to_i + item4.to_i + item5.to_i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment