#!/bin/bash
#
# Author: Twily 2017
# Description: Sum of numbers between N1 and N2
# Usage: sh ./sumnum 30 50
# Source: https://www.easycalculation.com/faq/1454/sum_of_numbers_from_51_to_100_is.php
#
N1=$1
N2=$2
SUM=$(( ($N2*($N2+1)/2)-($N1*($N1+1)/2) ))
AVG=$(( $SUM/2 ))
echo "SUM: $SUM"
echo "AVG: $AVG"
exit