Advertisement
cesarnascimento

ex7 repetiçao fernando

May 30th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. package exercicios;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class vetor1 {
  6.  
  7.     public static void main(String[] args) {
  8.        
  9.         int[] vA = new int[10];
  10.         int idade = 0;
  11.         Scanner sc = new Scanner(System.in);
  12.        
  13.         for(int i = 0;i<10;i++){
  14.             System.out.println("Digite a idade: ");
  15.             vA[i] = sc.nextInt();
  16.             if(vA[i] >= 18){
  17.                 idade++;
  18.             }
  19.  
  20.         }      
  21.         System.out.println("Pessoas com 18 anos ou mais: "+idade);
  22.            
  23.     }
  24.     /* César N. */
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement