import javax.swing.*; // program uses class Scanner

public class BPIH4E2B
{
     // main method begins execution of Java application
     public static void main( String args[] )
     {            
        int number1; // first number to add   
        int number2;  //last number to add      
        int sum=0; // sum of number1 and number2
        number1=Integer.parseInt(JOptionPane.showInputDialog("Enter first integer: ")); // read number
        number2=Integer.parseInt(JOptionPane.showInputDialog("Enter last integer: ")); // read number 
        for(int i=number1;i<=number2;i++)    
        { sum += i; // add numbers
        } 
        System.out.printf( "Sum from %d to %d = %d \n", number1,number2,sum ); // display sum
     } // end method main
} // end class BPIH4E1
