This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Correct output for this program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Correct output for this program?" Watch "Correct output for this program?" New topic
Author

Correct output for this program?

Matt Kidd
Ranch Hand

Joined: Jul 17, 2002
Posts: 259
This is the program:

This is the output I came up with:
1
4
9
16
25
36
49
64
81
100
Total is 385
Am I correct?
[ August 08, 2002: Message edited by: Matt Kidd ]
Chad McGowan
Ranch Hand

Joined: May 10, 2001
Posts: 265
You are correct. You could have found this out by running the program yourself!
Matt Kidd
Ranch Hand

Joined: Jul 17, 2002
Posts: 259
mental note....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Correct output for this program?
 
Similar Threads
synchronized run()
Int By Reference passing..
Runtime behavior after command-line invocation
how to compare the values in arrays
value of x?