Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "euler.st"
  2. "Program pro priklad z eulera, zjistovani delitelneho cisla."
  3.  
  4. Number extend [
  5.     isDivisibleBy: aNumber [
  6.     ^(self\\aNumber = 0).
  7.     ]
  8. ]
  9.  
  10. 1 to: (11*12*13*14*15*16*17*18*19*20) do: [ :x |
  11.  | isDividible pocitadlo |
  12.   isDivisible := true.
  13.   pocitadlo := 11.
  14.   [pocitadlo <= 20] whileTrue:
  15.   [
  16.     (x isDivisibleBy: pocitadlo) ifFalse: [
  17.       isDivisible := false.
  18.       pocitadlo := 20.
  19.     ].
  20.     pocitadlo := pocitadlo + 1.
  21.   ].
  22.   (isDivisible) ifTrue: [
  23.     Transcript show: 'Cislo je: ', x printString; cr.
  24.   ].
  25. ].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement