Last active
March 8, 2017 14:35
-
-
Save embed0/6e39ad2458a3bad8526b26aa2d0f2fa2 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
PIERWSZE! | |
#!/usr/bin/ruby | |
puts "Jak masz na imie?" | |
name = gets | |
puts "ile masz lat?" | |
age = gets.chomp | |
year = 2017 - age.to_i | |
puts "Daniel urodzil sie w roku %d" % [year] | |
DRUGIE! | |
#!/usr/bin/ruby | |
print "Podaj zdanie:" | |
text = gets | |
text.reverse! | |
print "Podaj liczę:" | |
number = gets | |
for i in 1..number.to_i | |
print text | |
end | |
TRZECIE! | |
#!/usr/bin/ruby | |
print "Podaj liczę:" | |
number = gets | |
sum = 1 | |
for i in 1..number.to_i | |
sum *= i | |
end | |
printf "%d! = %d", number, sum | |
#50! = 30414093201713378043612608166064768844377641568960512000000000000 | |
#100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 | |
#500! = 1220136825991110068701238785423046926253574342803192842192413588385845373153881997605496447502203281863013616477148203584163378722078177200480785205159329285477907571939330603772960859086270429174547882424912726344305670173270769461062802310452644218878789465754777149863494367781037644274033827365397471386477878495438489595537537990423241061271326984327745715546309977202781014561081188373709531016356324432987029563896628911658974769572087926928871281780070265174507768410719624390394322536422605234945850129918571501248706961568141625359056693423813008856249246891564126775654481886506593847951775360894005745238940335798476363944905313062323749066445048824665075946735862074637925184200459369692981022263971952597190945217823331756934581508552332820762820023402626907898342451712006207714640979456116127629145951237229913340169552363850942885592018727433795173014586357570828355780158735432768888680120399882384702151467605445407663535984174430480128938313896881639487469658817504506926365338175055478128640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | |
CZWARTE! | |
#!/usr/bin/ruby | |
print "Podaj maksymalna wartosc:" | |
numberr = gets | |
number = numberr.to_i | |
iter = 1 | |
sum = 2 | |
while sum < number | |
break if( (sum * 2) > number ) | |
sum *= 2 | |
iter += 1 | |
end | |
printf "2^%d = %d jest najwyzsza potego dwojki mniejsza niz %d", iter, sum, number | |
PIĄTE! | |
#!/usr/bin/ruby | |
printf 'Ty:' | |
command = () | |
while command != 'DO WIDZENIA' | |
command = gets.chomp | |
if command != command.upcase | |
puts "Niedosłsząca Babcia: CO! MOW GLOSNIEJ, SYNU!!!" | |
else | |
year = "19"+rand(30..50).to_s | |
puts "Niedosłsząca Babcia: NIE, NIE OD #{year}!" | |
end | |
end | |
SZÓSTE! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment