Questions tagged [fizzbuzz]

a game, algorithm and a common programming task of replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz"

Fizzbuzz is a game used to teach children division. Implementing an algorithm for that game is sometimes used as an interview task.

https://en.wikipedia.org/wiki/Fizz_buzz

290 questions
0
votes
3 answers

How to "if not an integer , alert and repeat prompt" ? the same with isNAN

i m struggling with this. How to "if not an integer , alert and repeat prompt" ? I have the alert working , but i cant make it to prompt again. The same with isNAN which is not working at all! Thank you $(document).ready(function () { var…
themaras
  • 3
  • 1
0
votes
2 answers

Creating a FizzBuzz Class in Ruby

I am trying to attempt to create a fizzbuzz class, however I feel as though I am not fully understanding how classes and objects in Ruby work. This is the problem I'm trying to solve is as follows: Build a class called FizzBuzz that takes two…
0
votes
1 answer

DRYing up jQuery FizzBuzz Exercise

I've run into an issue where I cannot save the repeated lines of code into variables and unsure why. Aside from that, I'm trying to set the new table next to the current instead of under or above it, but I haven't been able to manipulate the DOM to…
PMills
  • 161
  • 1
  • 1
  • 9
0
votes
2 answers

Python, Fizz Buzz inserting the range as a parameter of the function

I am using the fizz buzz exercise to learn a little about python. I have hardcoded a range of 1-100 but I was curious how I might accomplish the same result by passing the range into the function using the parameter? numbers = range (1,101) def…
0
votes
2 answers

FizzBuzz in Javascript: the code won't execute or print at all

Have been playing around with the FizzBuzz problem, and I am wondering why the following code won't execute, nothing gets printed to the console. var i = 0; while (i = 0, i < 100, i++ ) { if ( i % 3 === 0) { console.log("Fizz"); }…
sslss
  • 347
  • 2
  • 4
  • 12
0
votes
4 answers

fizzbuzz - can it be shorter?

WARNING:I'm not asking for a better code, I'm asking for a shorter code for HackerRank just to learn what can be done to shorten it. I'm newbie to Java and was trying out this FizzBuzz problem: Write a program that prints the numbers from 1 to 100.…
dono
  • 149
  • 1
  • 4
  • 16
0
votes
1 answer

why won't my program print the countOfX values?

thanks for all your help in the last few q's! I think I've only got one issue remaining. For some reason it won't print the values of countOfX variables? As far as I can see it should work so there is obviously something im missing! hopefully…
0
votes
4 answers

What have I done wrong with this loop?

This code should fully loop when it's run, without the loop it runs perfectly fine, but when I've added my loop the first part works fine, but then when you enter another number it shows the exact same result as before and it never changes, nor does…
0
votes
1 answer

Command-line Input Files (Fizz Buzz)

I am trying to brush up on my coding skills, and decided to try some of the problems on codeeval.com. One of the problems is the fizz buzz program. The solution to the problem is found on the link:…
stochasticcrap
  • 350
  • 3
  • 16
0
votes
1 answer

Ruby FizzBuzz And/Or

Here's the problem: "Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print…
hopheady
  • 37
  • 7
0
votes
1 answer

Fizzbuzz counters 1-20 and check for divideables and not dividables

So i have a problem with java that when i run the program the console prints out this "12Fizz4BuzzFizz78FizzBuzz11Fizz1314FizzBuzz1617Fizz19Buzz" what i want it to do is , if its dividable with BOTH 3 and 5 then print out fizzbuz if divideable…
user2764700
  • 29
  • 3
  • 3
  • 7
0
votes
3 answers

Why is this Fizzbuzz program failing with 100 numbers as opposed to 25?

If I set the variable numCount to 100, the program fails to be accurate, yet with a number such as 25, it works perfectly fine. What's going on? print "Fizzbuzz" numCount = 0 while numCount < 100: numCount = numCount + 1 if (numCount % 3)…
0
votes
3 answers

PHP Fizzbuzz Challenge

Someone at work as poised the challenge to create a script that prints the FizzBuzz game in as few likes as possible using PHP The challenge Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of…
Pez Cuckow
  • 14,048
  • 16
  • 80
  • 130
-1
votes
0 answers

How to call a function with parameter as a range in swift?

I want to print n numbers and pass them into a function one by one . How to pass a range as a parameter in a function call. for i in (1...100) { fizzBuzz(i : 1...100) print("/n") } func fizzBuzz(i : Int) { if(i%5==0){ …
anjali
  • 1
  • 2
-1
votes
1 answer

JAVA: returns a AbstractList which is filled but can't be seen were it is looped. Never seen programming style like this

This is the fastest solution for FizzBuzz program in leetcode(Question 412). I can't able to understand it line of execution and whats actually happening in program. Please help me out with explaining the line of execution of the program. Just tell…