Created
January 11, 2017 15:35
-
-
Save User0111/2f62518a48a4c2523b147b9d85a2c455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
int sum = 0; | |
Scanner scan = new Scanner(System.in); | |
int n = scan.nextInt(); | |
for(int i=0;i<=n;i++){ | |
sum = sum + i; | |
} | |
System.out.println("Сума арифметичного ряду від 0 до " + n +" = "+sum); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment