brewersfan1976

smallest_number.rb

Mar 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.24 KB | None | 0 0
  1. def smallestNumber(n)
  2.     if n == 1 then
  3.         return 0
  4.     end
  5.        
  6.     x = 1
  7.        
  8.     string = "1"
  9.        
  10.     while (x < n)
  11.         string = string + "0"
  12.         x = x + 1
  13.     end
  14.        
  15.     return string.to_i
  16. end
Advertisement
Add Comment
Please, Sign In to add comment