Main.java 449B

1234567891011121314151617181920212223
  1. import java.util.*;
  2. /**
  3. * Created by jaejoson
  4. */
  5. public class Main {
  6. public static void main(String[] args){
  7. Scanner in = new Scanner(System.in);
  8. System.out.println("Type in a number");
  9. double n = in.nextDouble();
  10. double sum = 0;
  11. while (n > 0) {
  12. sum = sum + n;
  13. n = n - 1;
  14. }
  15. System.out.println("Total sum of input is " + sum);
  16. }
  17. }