What, in your opinion, is the easiest way of removing the repetitiveness of this FizzBuzz program?
I hate having to repeat if statements, it annoys me.
Also, general fizzbuzz thread.
Also, if you think my code looks bad, then suck a dick because I did it in Vim because I'm too lazy to install a real text editor. So I don't have syntax highlighting, and compilation errors in g++ are cryptic at best.Code:#include <iostream>
using namespace std;
int main() {
int count = 1;
do {
if(!(count%3)) {
if(!(count%5)) {
cout << "FizzBuzz" << endl;
}
}
if(!(count%3)) {
cout << "Fizz" << endl;
} if (!(count%5)) {
cout << "Buzz" << endl;
} else {
cout << count << endl;
}
count++;
} while(count<100);
}
Anyway, yep. Anyone know any other programming interview challenges that are fun?