Advertisement
cesarnascimento

for impar ou par de 1 a 20 usando vetores

May 16th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1.  
  2. public class fsfs {
  3.  
  4.     /**
  5.      * @param args
  6.      */
  7.     public static void main(String[] args) {
  8.         int []par = new int [20];
  9.         int []impar = new int [20];
  10.  
  11.         for(int i = 0; i<20; i++){
  12.             if(i % 2 == 0){
  13.                 par[i]= i;
  14.                 System.out.println("par "+i);
  15.             }else{
  16.                 impar[i] = i;
  17.                 System.out.println("impar "+i);
  18.             }
  19.            
  20.         }
  21.  
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement