Showing posts with label bash addition of two values. Show all posts
Showing posts with label bash addition of two values. Show all posts

Saturday, May 30, 2015

Addition of Two Numbers in Bash

In this article I would like to share with you one of my passion in programming writing Bash Script in Linux to automate or to make simple programs under Linux operating system. This program is very simple it will ask the user to enter two numbers and then it will display the sum of the two numbers to the user.

I am using Cgywin a linux distribution operating system that enables you run linux commands under windows it is totally free to download over the Internet here is the link https://www.cygwin.com/.

I hope you will find my simple script useful in your learning bash scripting programming in Linux operating system. If you have some questions feel free to send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

People here in the Philippines can reach me at this number 09173084360.

Thank you and Happy Programming.




Sample Program Output


Program Listing

#!/bin/bash

echo -e "\n\n"
echo -e "\t\t Addition of Two Numbers"
echo -e "\n"
read -p  "Enter two numbers : " a b

sum=$((a+b))
echo -e "\n"
echo "The sum of $a and $b is $sum."
echo -e "\n"
echo -e "Thank you for using this program."