Ver Mensaje Individual
  #7  
Antiguo 09-02-2011
Avatar de DarkBlue
DarkBlue DarkBlue is offline
Miembro
 
Registrado: jun 2010
Posts: 105
Reputación: 17
DarkBlue Va por buen camino
seria algo asi ... bueno improvise el chiste es que pide números y si es un numero par el ciclo retrocede por eso la instrucción de i--;

Código PHP:
import java.io.IOException;


public class 
algo {

    
/**
     * @param args
     */
    
static java.io.BufferedReader s= new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
    static 
double[] a= new double [20];
    public static 
void main(String[] argsthrows  IOException {
        for (
double i=0;i<5;i=i+.5){
            
System.out.println("ingrese un numero "+"esta es la vuelta "+i);
            
a[(int) i]=Integer.parseInt(s.readLine());
            if (
a[(int) i]%2==0){
                
System.out.println("es par decrementaremos el ciclo "+i);
            
i--;//aquí esta el truco
                
            
}
        }

    }



por tu atención gracias!!
__________________
Todo es Relativo

Última edición por rgstuamigo fecha: 09-02-2011 a las 13:55:07. Razón: Estética en el código
Responder Con Cita