codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #include <string> using namespace std; int main() { for (int x = 1; x < 101; x++) { string output; if (x % 3 == 0) { output += "fizz"; } if (x % 5 == 0) { output += "buzz"; } if (output.empty()) { cout << x << endl; } else { cout << output << endl; } } }
Private
[
?
]
Run code
Submit