Application: Summing the Even Integers from 2 to 20
We now consider two sample applications that demonstrate simple uses of for
. The application in Fig. 5.5 uses a for
statement to sum the even integers from 2 to 20 and store the result in an int
variable called total
.
Sum is ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.