Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Program {
- public static void main(String[] args) {
- Scanner scNumb =new Scanner(System.in);
- int numb = scNumb.nextInt();
- int sum = 0;
- for(int i=1;i<=numb;i++){
- sum +=i;
- System.out.println(sum);
- }
- }
- }
- 1
- 3
- 6
- 10
- 15
- 1+0=1
- 1+2=3
- 3+3=6
- 6+4=10
- 10+5=15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement