Any other better ways than this messy code to write php script that finds the minimum number that is divisible from 1 to 12 -


My idea was something like the minimum number that divides from 1 to 12. The problem is that if I use the long-term position in all ways in the form of increase in numbers. What is a better way than this dirty code? Sorry, there's a beginning from level 0.

  & lt; For php ($ i = 1; $ i & lt; = 999999; $ i ++) {$ Num = 12 * $ i; If ($ num = 12 == 0) {if ($ num% 11 == 0) {if ($ num% 10 == 0) {if ($ num% 9 == 0) {if (num num% 8 == 0) {if ($ num = 7 == 0) {if ($ num = 6 == 0) {if ($ num = 5 == 0) {if ($ num = 4 == 0) {if ($ Num% 3 == 0) {if ($ num% 2 == 0) {ebb $ num; Go out(); }}}}}}}}}}}}}? & Gt; 

12; $ Num = $ max; While (true) {for ($ i = 2; $ i & lt; = $ max; ++ $ i) {if ($ num% $ i! == 0) break; } If ($ i & gt; $ Max) break; $ Num + = $ max; } Var_dump ($ num);

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -