Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
NotificationsYou must be signed in to change notification settings

Pragmatists/fizzbuzz-kata-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build

npm install
npm run test

Wymagania

FizzBuzz to gra w której gracze liczą po kolei: 1, 2... Ale gdy liczba jest podzielna przez 3, zamiast tej liczby należy powiedzieć "Fizz". Natomiast gdy liczba jest podzielna przez 5 trzeba powiedzieć "Buzz". Gdy liczba jest podzielna zarówno przez 3 jak i przez 5, trzeba powiedzieć "FizzBuzz".

Twoje zadanie to:

  1. Utwórz funkcję, która przyjmuje liczbę naturalną większą od 0 i zwraca dla niej reprezentację, będący odpowiedzią w grze Fizz Buzz.Np. dla liczby3 powinna zwrócić"Fizz".

  2. Utwórz program, który wypisuje na konsolę odpowiedzi dla liczb od 1 do 100 oddzielone przecinkami.Np. dla liczby3 progam powinien wyświetlić na ekranie"1,2,Fizz" (bez przecinka na końcu).

Dodatkowe opcjonalne wymagania:

  1. Fizz odpowiadamy również wtedy, gdy liczba zawiera cyfrę 3. Np."Fizz" dla31. Ale nadal"FizzBuzz" dla30,ponieważ jest także podzielne przez 5.

  2. Podobnie dla Buzz - także, gdy liczba zawiera cyfrę 5.

  3. Wprowadzamy nową zasadę: dla liczb podzielnych przez/zawierających 7 mówimyBar.Czyli na przykład: 14 -Bar, 21 -FizzBar

  4. Od teraz Fizz, Buzz i Bar mówimy dla podzielności przez/zawierania cyfr 5, 7 i 9 (zamiast 3, 5 i 7).

Requirements

In this games players count one after another: 1,2,3... But for multiples of 3 they need to say "Fizz" instead of the number. For the multiples of 5 say "Buzz" instead of the number. For numbers which are multiples of both 3 and 5 players need to say "FizzBuzz" instead of the number

You task is to:

  1. Write a function that takes one number (larger than 0) and return its representation in FizzBuzz gameFor instance, for number3 is should return"Fizz".
  2. Write a program that prints on console answers for numbers from 1 to 100, comma separatedFor instance, for number3 the application should print"1,2,Fizz" (notice no comma at the end).
  • Optional requirements:
  1. "Fizz" returned also when number contains digit 3
  2. "Buzz" returned also when number contains digit 5.
  3. "Fizz" and "Buzz" when number is multiple or contains digit: 7 i 9.

Good to know

Jest assertions:https://jestjs.io/docs/en/expect.html#methods

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp