Java program that prints the sum of the first ten positive integers
Posted by Samath
Last Updated: January 08, 2021

Write a Java program that prints the sum of the first ten positive integers.

public class Main
{
  public static void main(String[] args) {
        System.out.print("Sum of the first ten positive integers: ");
        System.out.println(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10);
  }
}
Related Content
Sum of two values in C
Sum of two values in C
Samath | Nov 09, 2014
C Program to find sum of two numbers
C Program to find sum of two numbers
Samath | Jan 02, 2017