fork download
  1. int main()
  2. {
  3. foreach (n; 1 .. 101)
  4. if (n % 15 == 0)
  5. console.log ("FizzBuzz");
  6. else
  7. if (n % 5 == 0)
  8. console.log ("Buzz");
  9. else
  10. if (n % 3 == 0)
  11. console.log ("Fizz");
  12. else
  13. console.log (n);
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:3:14: error: ‘n’ was not declared in this scope
     foreach (n; 1 .. 101)
              ^
prog.cpp:3:20: error: expected unqualified-id before ‘.’ token
     foreach (n; 1 .. 101)
                    ^
prog.cpp:3:22: error: expected unqualified-id before numeric constant
     foreach (n; 1 .. 101)
                      ^~~
prog.cpp:6:9: error: ‘else’ without a previous ‘if’
         else
         ^~~~
prog.cpp:8:13: error: ‘console’ was not declared in this scope
             console.log ("Buzz");
             ^~~~~~~
prog.cpp:11:13: error: ‘console’ was not declared in this scope
             console.log ("Fizz");
             ^~~~~~~
prog.cpp:13:13: error: ‘console’ was not declared in this scope
             console.log (n);
             ^~~~~~~
stdout
Standard output is empty