August 25, 2011

Example 1

Task:
Create an algorithm to display numbers 1-100 provided that:

  • Multiples of 3 is replaced with fizz

  • Multiples of 5 is replaced with  buzz

  • Multiples of 3 & 5 be replaced with fizzbuzz
Code :
for num 1 to 100
if mod 3*5 print fizzbuzz
else if mod 3 print fizz
else if mode 5 print buzz
else cetak num

No comments:

Post a Comment