Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public class Testq1 {
  2. public static void main(String[] args) {
  3. Chapter c = new Chapter();
  4. c.testloop();
  5. }
  6. }
  7. class Chapter {
  8. public void testloop(){
  9. for (int i = 0; i <= 101; i++) {
  10. if (i % 15 == 0) {
  11. System.out.println("FizzBuzz");
  12. } else if (i % 3 == 0) {
  13. System.out.println("Fizz");
  14. } else if (i % 5 == 0) {
  15. System.out.println("Buzz");
  16. } else {
  17. System.out.println(i);
  18. }
  19. i++;
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement