“Fizz Buzz” Réponses codées

Fizz Buzz Python

def fizz_buzz(input):
    if (input % 3 == 0) and (input % 5 == 0):
        return "FizzBuzz"
    if input % 3 == 0:
        return "Fizz"
    if input % 5 == 0:
        return "Buzz"
    else:
        return input


print(fizz_buzz(3))
Zero2Code

Fuzzbuzz

for (let i = 1, msg; i <= 100; i++, msg = '') {
  if (!(i % 3)) msg += 'Fizz';
  if (!(i % 5)) msg += 'Buzz';
  console.log(msg || i);
}
putsan

Fuzzbuzz

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);
}
Frantic Fish

fuzzbuzz

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")
		}
	}
}
gocrazygh

Fizz Buzz

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");
            }
        }

    }
}
Breakable Boar

Fizz Buzz Python

#made by myself :)
def FizzBuzz() :
    Numbers = 0
    for Numbers in range(101):
        if Numbers%3 == 0:
            print ("Fizz")
        if Numbers%5 == 0:
            print ("Buzz")
        if Numbers%3 == 0 and Numbers%5 ==0:
            print ("Fizz Buzz")
        else :
            print (Numbers)
FizzBuzz()
Important Impala

Réponses similaires à “Fizz Buzz”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code