FizzBuzz in Learn C++

There wasn’t a link on the FizzBuzz Project page so I’m putting this here.
Here is one of my solutions to the FizzBuzz Project. I know it’s longer than the standard answer but I find it to be fun.

  bool fizzBuzzed = false;
  for (int i = 1; i <= 100; i++){
    if (i % 3 == 0){
    	std::cout << "Fizz";
    	fizzBuzzed = true;
  	}
  	if (i % 5 == 0){
    	std::cout << "Buzz";
    	fizzBuzzed = true;
  	}
    if (!fizzBuzzed){
      std::cout << i;
    }
    std::cout << "\n";
    fizzBuzzed = false;
  }
5 Likes

@matthatters oh snap matt! make a pull request (https://github.com/sonnynomnom/Codecademy-Learn-C-Plus-Plus). i can add this in the course :slight_smile:

3 Likes