~scripts
55 itemsDownload ./*

55 itemsDownload ./*

..
dzen2
tiling
vosh
4cdl
4trips
alarm
ambient
ana-wall.sh
battery-monitor
brightness.sh
checkit
cleverbot.py
clock
color-gen
colors-hex
colorscheme.sh
compton
dailywall
dmenu
ffthumb
grid
gridmacro
gridmacro.kde
help
importw
indexer
install-all.sh
install-twily.sh
installng
keep-on
mp3ogg
orage
pipes
pipes.x
pipewire_bt.sh
ports
rain
randwall
rotate.sh
scan.sh
screen-dim
screencast
screencast2
scrot
scrotw
search
skull
slocker
starwars
streamit
sumnum
tty-colorize
usrmount
ytp
ytplay


scriptssumnum
1 971•  7 years ago•  DownloadRawClose
7 years ago•  1 971

{}
#!/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

Top
©twily.info 2013 - 2024
twily at twily dot info



2 028 933 visits
... ^ v