Advertisement
Hezzarry00

Untitled

Oct 22nd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. package selfexercise4;
  2.  
  3. public class DivisibleBy5and6 {
  4.     public static void main(String[] args) {
  5.        
  6.         int count = 1;
  7.         for(int number = 100; number <= 1000; number++) {
  8.             if(number % 5 == 0 && number % 6 == 0) {
  9.                 System.out.print(number + " ");
  10.                 count++;
  11.             } else {
  12.             while(count == 10) {
  13.                 System.out.println();
  14.                 count = 1;
  15.             }
  16.             }
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement