Здравствуйте.Начала изучать JAVA . Nested while loop не работает внутринняя loop

int year=0;
int  balance=10000;
int targetBalance=1000000 ;
if( balance==10000)
    System.out.println("Your balance is 10000");
else {
    System.out.println("Balance must be 10,000");
}

while (balance <= targetBalance)
{
    year++;
    balance=balance+balance;}
    if (balance== 100000)   //this loop not working
    {
        System.out.println("It takes 4 year to reach 100,000");
        // if to use break it just stop here program                  
    }        
    System.out.println( "It takes 7 year to reach 1000000");
}

Ответы (0 шт):