Write a shell script to calculate the Sum of first n Natural Numbers.

 


     Write a shell script to calculate the Sum of 

                    first n Natural Numbers.





Program =



#!/bin/bash

echo " UTSAV Gohel  - 91900104011"

 

echo "Enter the Upper limit = "

read n

 

for ((i=1; i<=$n; i++))

do

  sum=$((sum + $i))

done

echo "total of Natural no. = $sum"



Output =