Advertisement
Timur69

If

Apr 1st, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package Tasks2;
  2.  
  3. public class Cycle1 {
  4.     public static void main(String[] args) {
  5.  
  6.         for (int i = 1; i <= 100; i++) {
  7.             String str = "";
  8.             int a = str.indexOf(str);
  9.             if ((i % 5 == 0)) {
  10.                 str += "Buzz";
  11.             }
  12.             if (i % 3 == 0) {
  13.                 str += "Fizz";
  14.             }
  15.             if (str == str) {
  16.                 str += a;
  17.                 System.out.println(str);
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement