pastebin light

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

pastebin light //misacek

Posted by inv.rb on Tue 29 Nov 2011 5:53:42 CET
download | new post

  1.  
  2. #!/usr/bin/env ruby
  3.  
  4. def inverse_class(class_, width)
  5. found = false
  6. 0.upto(width-1){|i|
  7. res = (class_ * i) % width
  8. if res == 1 || res == width-1 then
  9. print "Inverzni prvek k [", class_, "]_", width, " je [", i, "]_", width, ".\n"
  10. found = true
  11. break
  12. end
  13. }
  14. print "Inverzni prvek k [", class_, "]_", width, " neexistuje.\n" if found == false
  15. end
  16.  

Syntax highlighting: