简体   繁体   中英

Need the output horizontally in Mozart OZ programming

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.!!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM