Advertisement
nicoedu

PAR IMPAR CON WHILE

Mar 29th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package javaapplication1;
  2. import java.util.Scanner;
  3. public class JavaApplication1 {
  4.  
  5.     public static void main(String[] args) {
  6.     Scanner sc=new Scanner (System.in);
  7.    
  8.     int contador=1;
  9.    
  10.     while (contador<=10) {
  11.    
  12.         System.out.println("ingrese un numero");
  13.         int num=sc.nextInt();
  14.        
  15.         if (num==0 || num<0){
  16.             System.out.println("ingrese numero mayor a cero");
  17.            
  18.                
  19.         if (num%2==0){
  20.             System.out.println(num + " es par ");
  21.         }
  22.         else {
  23.             System.out.println(num + " es impar ");
  24.         }
  25.        
  26.         contador++;
  27.          
  28.                    
  29.     }
  30.     }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement