Frage im Vorstellungsgespräch bei Direct Technology

Fizzbuzz

Antworten zu Vorstellungsgespräch

Anonym

12. Apr. 2015

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.

2

Anonym

14. Okt. 2020

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