0

Below given is the code I have made for finding Non- Prime numbers between 1-100 by using Mozart OZ programming language.

Code in Mozart OZ:

declare for A in 1..20 do for I in 2..A div 2 break:Ab do if A mod I ==0 then {Browse A} {Ab} end end end

Output in Mozart OZ is shown as :

4
6
8
9
10
12...This output is coming Vertically

However,I want the output Horizontally as shown below:

4|6|8|9|10|12....100

Please help me out in changing the code in Mozart OZ programming language as I am new to this language. Thanks.!!

  • You could use `System.show` instead of `Browse`. However, the output will go to stdout instead of the browser in this case. – wmeyer Jan 25 '18 at 08:39
  • @wmeyer thanks!!! Can you tell me how to see the standard out? I am new to this programming. – Jony Luthra Jan 25 '18 at 14:39

1 Answers1

0

Sorry for the late answer. I hope this is useful for someone else. I would do something like this:

declare
proc {NotPrime N ?R} %% R for Result.
   R=for A in 1..N collect:C do
        for I in 2..A div 2 break:Ab do
           if A mod I==0 then {C A} {Ab} end
        end
     end
end
{Browse {NotPrime 100}}

To display the complete list, go to Options in your Browser, then select Display Parameters... and set the Browse Limit Width to a greater number.

rbi
  • 1
  • 1