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
-3
votes
1 answer

Fizzbuzz in C accessing disk

I have made a simple fizzbuzz program in C, just for practicing some aspects of the C language. I am still learning it, I am coming from higher level languages. While running the program itself, with higher numbers, I noticed my HDD LED blinking on…
theHeXaGoNdev
  • 19
  • 1
  • 1
  • 5
-3
votes
2 answers

Variable inside array not updating its value in Java

I was taking a shot at the FizzBuzz problem and decided to use an array to store the first 15 results in array and then iterate through it. But the variable stored in array is not updating its value if updated later in the loop import…
-3
votes
1 answer

"too few arguments to function 'fizzbuzz'"?

This is my code for a fizzbuzz function. With 'int num' that prompts the user for an integer, then prints all of the numbers from one to that integer. void fizzbuzz(int num) { int i; printf("Max value? %d\n", num); for(i = 1; i <= num;…
Eric
  • 1
-3
votes
1 answer

errors in fizzbuzz in C using String approach?

So I was trying to solve the FizzBuzz challenge in various languages using the string method to improve the code. I got stuck in C because things work differently here. This is my code, I'm getting errors, can anyone explain them to me and help to…
Ashwini
  • 15
  • 6
-3
votes
1 answer

Unexpected Token on FizzBuzz Solution

I would like to console.log to print all the numbers from 1 to 100, with two exceptions. For numbers divisible by 3, print "Fizz" instead of the number, and for numbers divisible by 5 (and not 3), print "Buzz" instead. AND print "FizzBuzz" for all…
Felix
  • 1
  • 2
-3
votes
1 answer

Method fail when I follow Ruby rubocop style guide and use .zero? instead of == 0

I am trying to complete a coding exercise in Ruby, which is as follows: TODO: starting with an array of integers, return an array with integers and 'Fizz', 'Buzz' or 'FizzBuzz' Write a method fizz_buzz, which takes a number as an argument, and…
Grr La
  • 46
  • 6
-3
votes
1 answer

I am doing a fiizzBuzz array and I keep getting a null before my array

public String[] fizzBuzz(int start, int end) { int end1 = end - start; String [] new1 = new String[end]; for(int i = start; i < end; i++) { if(i % 3 == 0 && i % 5 == 0) { new1[i] = "FizzBuzz"; } else if(i % 3 == 0) { new1[i] =…
-3
votes
1 answer

Trying to execute FizzBuzz function.. why no work?

function fizzBuzz (start, end) { for ( var i = start; i <= end; i++ ) { if ( i % 3 === 0 && i % 5 === 0) { console.log(“fizzbuzz”); } else if ( i % 3 === 0) { console.log(“fizz”); } …
-4
votes
2 answers

FizzBuzz test case pass

I am wondering can someone please tell me where I am going wrong with this FizzBuzz. I get an error "not all code returns a value and struggling to find out exactly how to fix it. My code is below: for (int i = 0; i < input; i++) { if (i % 3 ==…
-4
votes
1 answer

Why is my fizzbuzz program not working correctly?

I have been struggling to make this work all day... Something does not seem right with the output like you would expect. The output that I have now: 1 FIZZ BUZZ 7 FIZZ 11 13... It is supposed to look like this: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz... It…
André Peña
  • 163
  • 3
-4
votes
3 answers

FizzBuzz in angular?

I am trying to learn Angular and I am trying to make a fizzBuzz however; I don't get result with 'both' conditions: Here is the app: var myApp = angular.module("myApp", []); myApp.controller("game", ["$scope", function($scope) { $scope.number =…
Mar
  • 1,526
  • 6
  • 21
  • 46
-4
votes
11 answers

Python FizzBuzz

I have been given this question to do in Python: Take in a list of numbers from the user and run FizzBuzz on that list. When you loop through the list remember the rules: If the number is divisible by both 3 and 5 print FizzBuzz If it's only…
Lorenzo Battilocchi
  • 862
  • 1
  • 10
  • 26
-5
votes
1 answer

Python fizzbuzz not giving correct output

My fizzbuzz code keeps giving me none as an output i dont know why please help. Here is my code: def FizzBuzz(num): for num in range (1,50): string = "" if num % 3 == 0: string = string + "Fizz" if num % 5 == 0: string = string +…
LoveBugg
  • 1
  • 1
-5
votes
1 answer

FizzBuzz question, I'm unable to solve this code. Read the below output and give the answer please

It takes an input n and outputs the numbers from 1 to n. For each multiple of 3, print "Fizz instead of the number. For each multiple of 5, prints "Buzz" instead of the number. For numbers which are multiples of both 3 and 5, output "FizzBuzz". You…
Advik
  • 1
  • 2
-6
votes
1 answer

I am interested in a more optimized solution for sum of all fizzbuzz numbers in a given range

The number fizzbuzz is composed of two numbers that is fizz and buzz. fizz represents the numbers that are divisible by 3 and buzz are the numbers that are divisible by 5. combining both fizzbuzz, are the numbers that is divisible by both 3 and 5.…
vijay pratap
  • 11
  • 1
  • 8
1 2 3
19
20