Guest User

Untitled

a guest
Jul 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. package numero;
  2.  
  3.  
  4. import javax.swing.JOptionPane;
  5.  
  6. public class Divisores {
  7.  
  8.  
  9.     public static void main(String[] args) {
  10.  
  11.         String acumulador = "";
  12.         int contador = 0;
  13.         for (int i = 1; i < 500; i++) {
  14.             if (i % 7 == 0) {
  15.                 acumulador = acumulador + i + "\n";
  16.                 contador++;
  17.             }if (contador == 5) {
  18.           acumulador = acumulador + "\n";
  19.           contador = 0;
  20.        
  21.         }
  22.      
  23.         }
  24.  
  25.      JOptionPane.showMessageDialog(null, "numeros divisibles entre 7: " +  acumulador);
  26.     }
  27. }
Add Comment
Please, Sign In to add comment