Advertisement
Guest User

Program

a guest
Oct 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package arr;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author CSE_IT
  13. */
  14. public class Arr {
  15.  
  16. /**
  17. * @param args the command line arguments
  18. */
  19. public static void main(String[] args) {
  20.  
  21. System.out.println("How many ages you want to input?");
  22.  
  23. Scanner input=new Scanner(System.in);
  24.  
  25. int n=input.nextInt();
  26.  
  27. int age[]=new int[n];
  28.  
  29. System.out.println("enter ages");
  30.  
  31. for(int i=0;i<n;i++){
  32. age[i]=input.nextInt();
  33.  
  34.  
  35. }
  36.  
  37. for(int i: age){
  38.  
  39. System.out.println(i);
  40.  
  41. }
  42.  
  43.  
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement