Advertisement
Stelios_Gakis

Exercise_3/Task_6

Sep 14th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. package Exercise_3;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Task_6 {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner(System.in);
  9.         int a = 0;
  10.         System.out.println("Print number");
  11.         int n = input.nextInt();
  12.  
  13.         for (int i = 0; i < n; i++){
  14.             a = a + (i + 1);
  15.             System.out.println(a);
  16.         }
  17.  
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement