View Code of Problem 30

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int c = 0;
		for (;true;) {
			int b = scanner.nextInt();
			
			for (int j = 0; j < b+1; j++) {
				c += j;
			}
			System.out.println(c);
			c = 0;
		}
	}
}

Double click to view unformatted code.


Back to problem 30