Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 310 Bytes

File metadata and controls

21 lines (15 loc) · 310 Bytes

Back

P1.2

Write a program that prints the sum of the first ten positive integers, 1 + 2 + ... + 10.


Solution:

import static java.lang.System.out;

class P0102 
{
  public static void main(String[] args) 
  {
    out.println(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10);
  }
}