jueves, 7 de mayo de 2015

PIRÁMIDE DE REDUCCIÓN USANDO " FOR " Y " N " COMO NUMERO CON DOS CLASES!!

PIRÁMIDE DE REDUCCIÓN USANDO " FOR " Y " N " COMO NUMERO
" EXAMEN "

PRIMER CLASE!!

public class Matematicas
{

    public static void CalcularSerie()
    {
        Scanner leer=new Scanner(System.in);
        System.out.println("DAME EL TAMAÑO DE LA SERIE!!  ");
        int num=leer.nextInt();
         int aux=num;
   
        for (int fila = 1; fila <= num; fila++)
        {

            for (int i =1 ; i<=aux; i++)
            {
                System.out.print(aux);
           
           
            }
            aux--;
            System.out.println(" ");
        }
     
     
    }
 
}

SEGUNDA CLASE!!

public class Examen40
{
    public static void main(String[] args)
    {
        Matematicas obj = new Matematicas();
        obj.CalcularSerie();

    }
 
}


Ejemplo:

DAME EL TAMAÑO DE LA SERIE!!
6
666666
55555
4444
333
22
1


No hay comentarios:

Publicar un comentario