Direct Technology Interview Question: Fizzbuzz... | Glassdoor.co.in

Interview Question

.NET Developer Interview Roseville, CA (US)

Fizzbuzz

Answer

Interview Answer

2 Answers

2

Do Jeff Atwood's famous "Fizzbuzz" test in Visual Studio. I'd heard of it before so it was pretty easy. Recruiter wrote down the time taken on a piece of paper. There were a couple times there already.

Interview Candidate on 11-Apr-2015
0

public class FizzBuzz {
    public static void main(String[] args)
    {

        for (int i=1; i<=100; i++)

        {
            if (i % 15 == 0)
                System.out.println ( "FizzBuzz" + " " );

                // number divisible by 5, print 'Buzz'
            else if (i % 5 == 0)
                System.out.println ( "Buzz" + " " );

                // number divisible by 3, print 'Buzz'
            else if (i % 3 == 0)
                System.out.println ( "Fizz" + " " );

                //number divisible by 15 (divisible by both 3 & 5), print 'FizzBuzz'
            else
                System.out.println ( i + " " );

        }

    }

}

Pavel on 14-Oct-2020

Add Answers or Comments

To comment on this, Sign In or Sign Up.