---
# System prepended metadata

title: David O'Comb Interview

---

# David O'Comb Interview

## FizzBuzz

Write for me a function that counts from 1 to 100 that for each iteration:

1. When the number is evenly divisible by 3, print `Fizz` to the console
2. When the number is evenly divisible by 5, print `Buzz` to the console
3. When the number is evenly divisible by both 3 **and** 5 print `FizzBuzz` to the console
4. Otherwise, just print the number

```

void findFizzBuzz(){


for (int i = 1; i<=100; i++){

if (i % 3 == 0) && (i % 5 == 0) {
  cout << "FizzBuzz" << endl;
else if a%3==0{
  cout << "Fizz" << endl;
 }
else if a%5==0{
  cout << "Buzz" << endl;
 }
else {
 cout << a << endl;
}
}



}
```

```
1
2
Fizz
4
Buzz
...
14
Fizz (FizzBuzz)
```