Skip to content

Instantly share code, notes, and snippets.

@iwagaki
Created February 26, 2017 14:31
Show Gist options
  • Save iwagaki/4af9d396b14b26193b03f8fca711265b to your computer and use it in GitHub Desktop.
Save iwagaki/4af9d396b14b26193b03f8fca711265b to your computer and use it in GitHub Desktop.
FizzBuzz
// #include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <algorithm>
// #include <map>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define CHECK(x) if (!(x)) { assert(x); abort(); }
int main() {
for (int i = 1; i <= 100; ++i) {
if (i % 3 == 0 && i % 5 == 0) {
printf("FizzBuzz\n");
} else if (i % 3 == 0) {
printf("Fizz\n");
} else if (i % 5 == 0) {
printf("Buzz\n");
} else {
printf("%d\n", i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment