'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.!!
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | rbi |