Write Java code that uses a for statement to sum the numbers from 1 through 50. Display the total sum to the console.

What will be an ideal response?


```
int sum = 0;
for(int i=1; i <= 50; i++)
{
sum += i;
}
System.out.println("The total is: " + sum);
```

Computer Science & Information Technology

You might also like to view...

In the following problems, compute the radius in inches of the following circles drawn on a computer screen. Two points, with coordinates measured in pixels, define each circle. The first point marks the center of the circle and the second marks a point on the circumference. The radius is the distance between the two points. Assume that a pixel is a dot with diameter of 0.28 millimeters.

(400, 100) and (600, 300) Radius is distance between center (x1, y,) and point on the circumference (x2, Y2). Distance (r) can be found using the Pythagorean equation:

Computer Science & Information Technology

If you must write down your password, what should you do with it?

A) Put it in your desk drawer B) Put it on a sticky note on your monitor C) Put it under your keyboard D) Put it in a safe place

Computer Science & Information Technology

Describe the Transport Layer of the OSI model..

What will be an ideal response?

Computer Science & Information Technology

A ________ is a column (or set of columns) which have a unique value that cannot be duplicated in other rows?

a. primary key. b. query. c. SQL statement. d. lookup value.

Computer Science & Information Technology