Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package numero;
- import javax.swing.JOptionPane;
- public class Divisores {
- public static void main(String[] args) {
- String acumulador = "";
- int contador = 0;
- for (int i = 1; i < 500; i++) {
- if (i % 7 == 0) {
- acumulador = acumulador + i + "\n";
- contador++;
- }if (contador == 5) {
- acumulador = acumulador + "\n";
- contador = 0;
- }
- }
- JOptionPane.showMessageDialog(null, "numeros divisibles entre 7: " + acumulador);
- }
- }
Add Comment
Please, Sign In to add comment