Created
February 26, 2017 14:31
-
-
Save iwagaki/4af9d396b14b26193b03f8fca711265b to your computer and use it in GitHub Desktop.
FizzBuzz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #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