Iterate Years

Using a for loop , we will iterate through all years. We start from 1800 – the year in that Ivancho returns, and we reach the year until he must live. We check in the loop if the current year is even or odd. We do this through division with remainder (%) by 2. If the year is even, we subtract from heritage 12000, and if is odd, we subtract from heritage 12000 + 50 * (years).

results matching ""

    No results matching ""