Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

FizzBuzz

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

fizz buzz

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)
Comment

FizzBuzz

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

FIzzBuzz

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

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

    }
}
Comment

fizzbuzz

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

PREVIOUS NEXT
Code Example
Python :: python os.path.join 
Python :: python tutorial pdf 
Python :: not equal to python 
Python :: Matplotlib add text to axes 
Python :: To create a SparkSession 
Python :: best algorithm for classification 
Python :: what are test cases in python 
Python :: multiple input to list 
Python :: pyqt set focus 
Python :: python ascii to string 
Python :: pytorch dill model save 
Python :: convert python project to exe 
Python :: python Sort the dictionary based on values 
Python :: django save object in view 
Python :: inconsistent use of tabs and spaces in indentation 
Python :: django background_task 
Python :: exit code python 
Python :: argparse flag without value 
Python :: raw string python 
Python :: intersection of three arrays 
Python :: teardown module pytest 
Python :: download python libraries offline 
Python :: difference between set and list in python 
Python :: change column values based on another column pandas 
Python :: python check if string or list 
Python :: creating methods in python 
Python :: append dictionary python 
Python :: Static Language Programmers 
Python :: django model inheritance 
Python :: DIVAB Solution 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =