View Single Post
Old 11-27-2010, 08:29 AM   PM User | #3
corecase
New to the CF scene

 
Join Date: Nov 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
corecase is an unknown quantity at this point
This is how i would do it:

Code:
int m = mark;
int d = daysLate;

if(m <= 20)
{
    System.out.println("Mark is: " + m);
}
else
{
    while(d >= 0 && m > 20)
    {
         m -= 5;
         d--;
    }
    System.out.println("Mark is: " + m);
}
I think it's a bit easier to understand than using a for loop with two variables inside. Just my opinion though! Hope it helps!
corecase is offline   Reply With Quote