diff options
Diffstat (limited to 'ruby/conversioneBinariaDec.ru')
-rw-r--r-- | ruby/conversioneBinariaDec.ru | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/ruby/conversioneBinariaDec.ru b/ruby/conversioneBinariaDec.ru deleted file mode 100644 index c506372..0000000 --- a/ruby/conversioneBinariaDec.ru +++ /dev/null @@ -1,32 +0,0 @@ -b = 32 -v = Array.new(b, 0) - -stringa = gets.to_s - -unless stringa.size > b then - valVuoto = stringa.size -end - -i = b - valVuoto -j = 0 - -loop do - v[i] = stringa[j].to_i - - i += 1 - j += 1 - - break unless i < b -end - -i = b - 1 -j = 0 -num = 0 - -while i > -1 do - num += v[i] * (2 ** j) - i -= 1 - j += 1 -end - -puts num/2 |