package javaapplication1;
// 1 + 2 + 3 + 4 + ... + N
public class JavaApplication1 {
public static void main(String[] args) {
int n = 10, sum = 0;
while (n > 0)
{
sum += n;
n--;
}
System.out.format("The sum is: %d\n", sum);
}
}
/*
run:
The sum is: 55
*/