Created
January 9, 2013 23:28
-
-
Save lrlucena/4498000 to your computer and use it in GitHub Desktop.
Lista de Exercícios do dia 08/01/2013
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
#encoding: UTF-8 | |
puts "Meu primeiro programa!" |
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
#encoding: UTF-8 | |
puts "Avenida Senador Salgado Filho, 1559," | |
puts "Tirol, Natal-RN, Brasil" | |
puts "CEP: 59015-000" | |
puts "e-mail: [email protected]" | |
puts "Telefone: 4005-2600" |
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
#encoding: UTF-8 | |
puts "Oi #{gets.chomp}, bom dia!" |
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
n1 = gets.to_i | |
n2 = gets.to_i | |
soma = n1 + n2 | |
puts soma | |
# alternativa | |
# puts gets.to_i + gets.to_i |
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
nota1 = gets.to_i | |
nota2 = gets.to_i | |
media = (nota1*2 + nota2*3) / 5 | |
puts media |
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
n1 = gets.to_i | |
n2 = gets.to_i | |
n3 = n1 + n2 | |
n1_str = "%5d" % n1 | |
n2_str = "%5d" % n2 | |
n3_str = "%5d" % n3 | |
puts n1_str | |
puts n2_str | |
puts "-"*5 | |
puts n3_str |
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
nome = gets.chomp | |
matricula = gets.chomp | |
n1 = gets.to_i | |
n2 = gets.to_i | |
n1_str = "%.1f" % n1 | |
n2_str = "%.1f" % n2 | |
media = (n1+n2)/2 | |
media_str = "%.1f" % media | |
puts "#{matricula} - #{nome} - #{n1_str}:#{n2_str}:#{media_str}" |
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
valor = gets.to_f | |
dez_porcento = valor / 10 | |
total = valor + dez_porcento | |
puts "Valor : #{"%8.2f" % valor}" | |
puts "10% : #{"%8.2f" % dez_porcento}" | |
puts "Total : #{"%8.2f" % total}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment