for (let i = 1, msg; i <= 100; i++, msg = '') {
if (!(i % 3)) msg += 'Fizz';
if (!(i % 5)) msg += 'Buzz';
console.log(msg || i);
}
for i in range(1, 101):
if i % 3 == 0 and i % 5 == 0:
i = "FizzBuzz"
elif i % 3 == 0:
i = "Fizz"
elif i % 5 == 0:
i = "Buzz"
print (i)
for (let i = 1; i <= 100; i++) {
let f = i % 3 == 0,
b = i % 5 == 0;
console.log(f ? (b ? 'FizzBuzz' : 'Fizz') : b ? 'Buzz' : i);
}
for (var i = 1; i < 101; i++) {
if (i % 6 == 0) console.log("FizzBuzz");
else if (i % 2== 0) console.log("Fizz");
else if (i % 3 == 0) console.log("Buzz");
else console.log(i);
}
import java.util.Scanner;
public class SecondFizzBuzz {
public static void main (String[] args){
Scanner userInput = new Scanner(System.in);
int n = userInput.nextInt();
for (int i = 0; i < n; i++) {
if (n%3==0&& n%5==0) {
System.out.println("FizzBuzz");
} else if(n%5==0) {
System.out.println("Buzz");
} else if(n%3==0 ) {
System.out.println("Fizz");
}
}
}
}
package main
import "fmt"
func main() {
for i := 0; i < 100; i++ {
fmt.Println(i)
if i % 3 == 0 {
fmt.Println(i, "Fizz")
}else if i % 5 == 0{
fmt.Println(i, "Buzz")
}
}
}