// WhileExample.java – Demonstrates the use of while
class WhileExample {
public static void main(String args[]) {
int sum = 0, n = 1;
while ( n <= 10) {
sum = sum + n;
n = n + 1;
}
System.out.println("Sum = " + sum);
}
}