FizzBuzzMain.java 435B

1234567891011121314151617181920212223
  1. /**
  2. * Write a description of class FizzBuzzMain here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class FizzBuzzMain
  8. {
  9. public String main(int y)
  10. {
  11. if (y % 3 == 0 && y % 5 == 0){
  12. return "FizzBuzz";
  13. }else if (y % 3 == 0){
  14. return "Fizz";
  15. } else if (y % 5 ==0){
  16. return "Buzz";
  17. }else {
  18. return "2";
  19. }
  20. }
  21. }