Untitled
#include <iostream> using namespace std; int main() { int n = 100; for (int i = 1; i <= n; i++) { if (i % 3 == 0) { cout << "fizz"; } if (i % 5 == 0) { cout << "buzz"; } if ((i % 3 == 0) && (i % 5 == 0)) { cout << "fizzbuzz"; } else cout << i << " "; } }
Leave a Comment