Created
December 22, 2013 13:19
-
-
Save mertyildiran/8082527 to your computer and use it in GitHub Desktop.
String içerisindeki sayıları toplama
This file contains 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
girdi = "on3d1oku5zm7ayis3" | |
sayilar = "0123456789" | |
toplam = 0 | |
i=0 | |
while i < girdi.length | |
j=0 | |
while j < sayilar.length | |
if girdi[i] == sayilar[j] | |
toplam += girdi[i].to_i | |
end | |
j += 1 | |
end | |
i += 1 | |
end | |
puts toplam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment