Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.suarez;
- /*
- Arush Adabala
- 12/27/2018
- Program to print the sum of numbers.
- */
- import java.util.*;
- public class SumNumbers {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("What is your low value?");
- int low = input.nextInt();
- System.out.print("What is your high value?");
- int high = input.nextInt();
- int sum = 0;
- for (int i = low; i <= high; i++) {
- sum += i;
- }
- System.out.println("sum = " + sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement