chillurbrain

Untitled

Sep 22nd, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Task3
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.        Scanner sc = new Scanner(System.in);
  8.        int num = sc.nextInt();
  9.        int result = 0;
  10.        for (int i = 1; i <= num; i++)
  11.        {
  12.            for (int j = 1; j <= i; j++)
  13.            {
  14.                result +=j;
  15.            }
  16.        }
  17.        System.out.print(result);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment