10 REM FIZZBUZZ SOLUTION BY CHRISTOPHER HAVEL, 2012
20 REM IMPLEMENTED IN QBASIC
30 PRINT
40 COUNT% = 0
50 COUNT% = COUNT% + 1
60 IF COUNT% MOD 3 = 0 THEN GOTO 100 ELSE GOTO 80
70 IF COUNT% MOD 5 = 0 THEN GOTO 120 ELSE GOTO 80
80 PRINT COUNT%
90 IF COUNT% = 100 THEN GOTO 140 ELSE GOTO 50
100 IF COUNT% MOD 5 = 0 THEN PRINT "FIZZBUZZ" ELSE PRINT "FIZZ"
110 IF COUNT% = 100 THEN GOTO 140 ELSE GOTO 50
120 IF COUNT% MOD 3 = 0 THEN PRINT "FIZZBUZZ" ELSE PRINT "BUZZ"
130 IF COUNT% < 100 THEN GOTO 50
140 PRINT
150 PRINT "ALL DONE!"
160 END
By some reason, they still teach Basic (Pascal too) to programmers in some Universities here...
Didn't knew people still "GOTO" voluntarily... _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum