I try to write a buz slip through the cycle through a I am using the modulus operator to detect a module: I have written the code below, all of them Parts have been tested and it seems to work, but when I run the script, it gets trapped in an infinite loop, Was anyone wrong? Online demo: while loop numbers I am
1-100 and
resonance every one on the screen
Fiz .
$ i = 1; While ($ i & lt; = 100) {if ((3% $ i) === 0) {echo 'fish'; $ I = $ i ++; } And if ((5% $ i) === 0) {$ i = $ i ++; Echo 'buz'; } And if (((3% $ i) === 0) & amp; ((5% $ i) === 0)) {echo 'FizzBuzz'; } Else {echo $ i ++; }}
$ i = 1; While ($ i & lt; = 100) {$ r = ''; If ($ i% 3 === 0) {$ r = 'Fitz'; } If ($ i% 5 === 0) {$ r = 'Buzz'; } If (! $ R) {$ r = $ i; } Repeat "$ r \ n"; ++ $ i; }
No comments:
Post a Comment