Bienvenido(a), Visitante. Favor de ingresar o registrarse.

Ingresar con nombre de usuario, contraseña y duración de la sesión
  H *
INICIO AYUDA BUSCAR LOGIN REGISTRO
Foros de Estudiantes Ingeniería en Computación - Universidad Central de Chile > General > Centro de Apuntes > Introducción a la Programación > for anidados
Páginas: [1]
« anterior próximo »
Imprimir
Share this topic on FacebookShare this topic on GoogleShare this topic on TwitterShare this topic on Yahoo
Autor Tema: for anidados  (Leído 27 veces)
cervezoruler
Administrador
Padawan!
*****
Mensajes: 219



Ver Perfil
for anidados
« en: Julio 28, 2010, 08:51:00 »

public void foranidados() {
        int aux = 10;
        for (int i = 1; i < 6; i++) {
            for (int j = i; j < aux; j++) {
                System.out.print(j);
            }
            if (i % 2 == 1) {
                aux -= 2;
            } else {
                aux++;
            }
            System.out.println();
        }
    }

solucion
123456789
234567
345678
456
567
En línea


<!-- Facebook Badge START --><a href="http://es-la.facebook.com/admOwner" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color:
Páginas: [1]
Imprimir
« anterior próximo »
 
Ir a:  


Powered by SMF 1.1.11 | SMF © 2006-2008, Simple Machines LLC
| NewDef design by Bloc
Loading...