1234567891011121314151617181920212223242526 |
-
- /**
- * Write a description of class FizzBuzz here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzz
- {
- private int x;
-
- public String fizzBuzz(int x){
- if(x % 3 == 0 && x % 5 == 0){
- return "FizzBuzz";
- } else
- if(x % 5 == 0){
- return "Buzz";
- } else
- if(x % 3 == 0){
- return "Fizz";
- } else {
- return ""+x;}
-
- }
- }
|