FizzBuzz
Try solving this very simple program which is asked in many interviews, especially to testers who use a lot of scripting in automation:
- 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 “FizzBuzz”
Most tester's who know to code are not able to solve this simple problem. Out of every ten automation engineers i have interviewed 9 weren't able to solve this simple problem.
---------------------------------------------------------------------------------------------------------------
Lets look at the simple algo:
For n = 1 To 100 Select Case 0 Case n Mod 15 f = "FizzBuzz" Case n Mod 3 f = "Fizz" Case n Mod 5 f = "Buzz" Case Else f = n End Select Print f
Next n
Comments
Post a Comment