View Code of Problem 30

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {	
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()) {
			int number = scan.nextInt();
			int sum=0;
			while(number>0){
				sum += number;
				number--;
			}
			System.out.println(sum);
		}
		scan.close();
		}
}

Double click to view unformatted code.


Back to problem 30