~scripts
58 itemsDownload ./*

58 itemsDownload ./*

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


scriptssumnum
2 184•  7 years ago•  DownloadRawClose
7 years ago•  2 184

{}
#!/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 158 797 visits
... ^ v