12345678910111213141516171819202122232425
  1. /**
  2. * Created by iyasuwatts on 10/17/17.
  3. */
  4. import java.util.Scanner;
  5. public class Main
  6. {
  7. public static void main(String[] args)
  8. {
  9. Scanner input = new Scanner(System.in);
  10. System.out.println("Enter a number: ");
  11. int n = input.nextInt();
  12. int sum=0;
  13. for(int i=1;i<=n;i++)
  14. {
  15. sum+=i;
  16. }
  17. System.out.println("The sum is : " + sum);
  18. }
  19. }