Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

shell script to find sum of n numbers using for loop

#shell script to find sum of n numbers using for loop
  
echo "Enter Size(N)"
read N

sum=0

echo "Enter Numbers"
for((i=1;i<=N;i++))
do
  read num           #get number
  sum=$((sum + num)) #sum+=num
done

echo $sum
Comment

PREVIOUS NEXT
Code Example
Shell :: pacman purge 
Shell :: how to use github to setup projects 
Shell :: gradle test 
Shell :: crontab command 
Shell :: start grafana server wsl 
Shell :: wordpress set tagline from cli 
Shell :: bash replace specific line in file 
Shell :: bash: rspec: command not found 
Shell :: Copy local repository for remote servers git 
Shell :: install npm windows subsystem linux 
Shell :: how to compare percentage value in shell script 
Shell :: pretty git branch graph print 
Shell :: attach iam role to ec2 instance cli 
Shell :: aws cli stop rds instance 
Shell :: remove pod and install again 
Shell :: install scala on mac 
Shell :: how to add this package include: package:flutter_lints/flutter.yaml 
Shell :: downoad woe usb or ubuntu linux 
Shell :: The CUDA compiler identification is unknown CMake Error at CMakeLists.txt:441 (enable_language): No CMAKE_CUDA_COMPILER could be found. 
Shell :: using docker as a managed vm 
Shell :: git pull on another branch 
Shell :: default gatsby typescript started 
Shell :: install lua on ubuntu 
Shell :: pacman corrupted package 
Shell :: create new git branch and switch to it 
Shell :: create github repo without browser 
Shell :: arrow folder file github 
Shell :: add stetho plugin ionic 
Shell :: ubuntu command upgrade application 
Shell :: code in terminal 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =