Home /
Expert Answers /
Computer Science /
oz-programming-language-nbsp-3-write-a-threaded-program-which-produces-an-input-stream-from-0-to-pa363
(Solved): OZ programming language
3. Write a threaded program which produces an input stream from 0 to ...
OZ programming language
3. Write a threaded program which produces an input stream from 0 to 100, filters out the odd numbers, then returns the sum. (Each of these three operations will occur in their own threads).
declare SumOdd in import Thread SumOdd = 0 proc {Filter X} if X mod 2 == 1 then SumOdd = SumOdd+X end end end proc {Sum} SumOdd = 0 for I in 0..100 do {Filter I} end SumOdd end Sum Thread.e