Advertisement
Arush22

Untitled

Dec 27th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package com.suarez;
  2. /*
  3. Arush Adabala
  4. 12/27/2018
  5. Program to print the sum of numbers.
  6. */
  7. import java.util.*;
  8.  
  9. public class SumNumbers {
  10. public static void main(String[] args) {
  11. Scanner input = new Scanner(System.in);
  12. System.out.print("What is your low value?");
  13. int low = input.nextInt();
  14. System.out.print("What is your high value?");
  15. int high = input.nextInt();
  16. int sum = 0;
  17. for (int i = low; i <= high; i++) {
  18. sum += i;
  19. }
  20. System.out.println("sum = " + sum);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement