Java program that uses a loop to compute the sum of all even numbers between 2 and 100 (inclusive)
###### Posted by Samath
Last Updated: April 03, 2022

Write a Java program that uses a loop to compute the sum of all even numbers between 2 and 100 (inclusive).

Code:

```import java.util.Scanner;

public class Main
{
public static void main(String[] args) {

double total = 0;
for (int i = 0; i < 101; i += 2) {
total += i;
}
System.out.println("Result: " + total);
}
}
```
###### Java program that uses a loop to compute the sum of all squares between 1 and 100 (inclusive)
Samath | Apr 03, 2022
###### Java program that uses a loop to compute the sum of all even numbers between a and b (inclusive), where a and b are inputs
Samath | Apr 03, 2022
###### Java program that uses a loop to compute the sum of all odd digits of an input. (For example, if the input is 32677, the sum would be 3 + 7 + 7 = 17.)
Samath | Apr 03, 2022
###### C Program to Compute sum of the array elements using pointers
Samath | Jan 02, 2017
###### How do you find the sum of elements in a list using a loop in Python?
FrankMl | Aug 13, 2024
###### How can you find the sum of elements in a list using a while loop in Python?
HenryPk | Aug 18, 2024
###### How can you find the sum of elements in a list using a for loop in Python?
EveClark | Aug 17, 2024
###### How can you find the sum of elements in a list using a loop with a break statement in Python?
FrankMl | Aug 14, 2024
###### How can you find the sum of elements in a list using a loop with a continue statement in Python?
FrankMl | Aug 08, 2024
###### How can you find the sum of elements in a list using a loop with a pass statement in Python?
DavidLee | Aug 25, 2024
###### How can you find the sum of elements in a list using a loop with a return statement in Python?
NickCrt | Aug 25, 2024
###### How can you find the sum of elements in a list using a loop with an exit statement in Python?
AliceWk | Aug 15, 2024
###### How can you find the sum of elements in a list using a loop with an error handling block in Python?
JackBrn | Aug 12, 2024
###### Sum of two values in C
Samath | Nov 09, 2014