Skip to content

Instantly share code, notes, and snippets.

@svracak
Forked from shime/šesti_zadatak.rb
Created February 25, 2012 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svracak/1909066 to your computer and use it in GitHub Desktop.
Save svracak/1909066 to your computer and use it in GitHub Desktop.
### Napišite metodu koja prima string i vraća broj pojavljivanja slova a u tom stringu
def vraca_slova(neki_string)
i=0
neki_string.split(//).each do |x|
if(x == "a")
i=i+1
end
end
puts i
end
vraca_slova(gets)
### Napišite metodu koja prima string a ispisuje ga unazad
def obratno(string)
puts string.reverse
end
obratno(gets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment