Code:
Title: string = (' BUZZ FIZZ ');
By: string = (' By Steve Green ');
You don't need the parentheses. Hence:
Code:
Title: string = ' BUZZ FIZZ ';
By: string = ' By Steve Green ';
Next..
You declare the variable "j", but never assign it a value; you are depending on the value of an uninitialized variable being 0, which is not a good idea. What reason are you using that variable? If it is just to compare to 0, then the code would be more meaningful if you just used 0.
Similarly, you use the variable "int", which is neither declared nor initialized anywhere (the code as you pasted it shouldn't even compile), for the same reason. Again, if you just are comparing the result of the mod operation to zero, just use 0. Hence:
Code:
if ((i mod 5) = 0) then
write(i,' = FIZZ ')
else
if ((i mod 3) = 0) then
...
if ((i mod 15) = 0) then
write(i,' = BUZZ FIZZ ')
else
if ((i mod 5) = 0) then
write(i,' = FIZZ ')
else
if ((i mod 3) = 0) then
Lastly,
Code:
writeln ('Press Return to continue',ch);
I pointed this out in the previous thread. There is no need to output the dummy input variable you are using to pause output. This will work fine:
Code:
writeln ('Press Return to continue');
Bookmarks