Calculator Program in Linux

by PrinceT1 in Circuits > Linux

4079 Views, 5 Favorites, 0 Comments

Calculator Program in Linux

images (1).jpg

Its a simple calculator program for beginners in Linux,

Things Required

1. Laptop or Desktop

2. Linux OS (I Prefer Fedora)

3. NormalBrain

Program

case $1 in

"add") echo "sum $2 $3:`expr $2 + $3`"

;;

"sub") echo "diff $2 $3:`expr $2 - $3`"

;;

"mul") echo "mul $2 $3:`expr $2 \* $3`"

;;

"div") echo "div $2 $3:`expr $2 \/ $3`"

;;

esac

How to Begin

images.jpg
gedit-main.jpg

1. Open the Gedit Text Editor {Applications -> Accessories -> Gedit text editor}

2. Type the program and save it as in ‘ .sh ’ format (.sh means Shell Script}ShellScripting

3. Save the program in Desktop or any other folders

4. Go to Command prompt and type 'SU' for accessing Root Server

5. Enter Your Login Password and Go to your Program Folder ,where we saved our calculator program {you can use 'cd' command for changing directory.'cd..' for Going back to the previous directory and use 'ls' for seeing the list of directories}

6. call your program by using ' ./ ' name of the program