Skip to content

Instantly share code, notes, and snippets.

@luketlancaster
Created July 11, 2015 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luketlancaster/a4a67c8a7133a3005f13 to your computer and use it in GitHub Desktop.
Save luketlancaster/a4a67c8a7133a3005f13 to your computer and use it in GitHub Desktop.
FizzBuzz c++
int a = 0;
void setup() {
Serial.begin(9600);
Serial.println("FizzBuzz:");
}
void loop() {
if (a % 15 == 0)
{
Serial.println("FizzBuzz");
a++;
delay(500);
}
else if (a % 5 == 0)
{
Serial.println("Buzz");
a++;
delay(500);
}
else if (a % 3 == 0)
{
Serial.println("Fizz");
a++;
delay(500);
}
else
{
Serial.println(a);
a++;
delay(500);
}
}
@luketlancaster
Copy link
Author

FizzBuzz, written for Arduino

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment