Sum of two variables without using expr in shell script - CodexRitik

Sum of two variables without using expr in shell script:

1.initialize two variables
2. Add two variables directly using $(...) 
3. Echo the final result.

  • Code:
#Sum of two numbers without using expr
num1=20
num2=10
sum=$(($num1 + $num2))
echo "Sum Of Two Numbers : $sum"


  • Output:
Sum Of Two Numbers : 30


  • Click On Image For Program view:


                                               
Sum of two number without using expr in shell




🙏THANKS FOR VISIT🙏
Sum of two variables without using expr in shell script - CodexRitik Sum of two variables without using expr in shell script - CodexRitik Reviewed by CodexRitik on July 11, 2020 Rating: 5

No comments:

Powered by Blogger.