JoseLargo

Untitled

Dec 6th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package ejercicio4;
  2.  
  3. import java.util.*;
  4. public class Ejercicio4 {
  5.  
  6.    
  7.     public static void main(String[] args) {
  8.         Scanner sc= new Scanner(System.in);
  9.         int tam, aux;
  10.         int [] array;
  11.         aux=0;
  12.        
  13.         System.out.println("Introduce tamaño de tu array: ");
  14.         tam=sc.nextInt();
  15.         array =new int [tam];
  16.        
  17.         for (int i = 0; i < tam; i++) {
  18.             System.out.println("Introduce dato en posicion "+i+" para el array: ");
  19.             array[i]=sc.nextInt();
  20.         }
  21.         for (int i = 0; i < tam; i++) {
  22.             while(aux!=array[i]){
  23.                 aux++;
  24.             }
  25.             System.out.println(" ");
  26.             while(aux!=0){
  27.                 System.out.print("* ");
  28.                 aux--;
  29.             }
  30.         }
  31.     }
Add Comment
Please, Sign In to add comment