123456789101112131415161718192021222324252627282930313233343536 |
-
- /**
- * Write a description of class FizzBuzzConverter here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class FizzBuzzConverter
- {
- // public fizzBuzz(){}
-
- public String fizzBuzz(int y){
-
- String result ="";
- if(y %5 == 0 && y %3 ==0){
- result = "Fizz Buzz";
- }
- else if(y %3 == 0){
- result = "Fizz";
-
- }
- else if(y %5 == 0){
- return "Buzz";
- }else{
- result =Integer.toString(y);
- }
- return result;
-
-
-
-
-
- }
-
- }
|