Calculator Program in Linux

1,937

5

Its a simple calculator program for beginners in Linux,

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things Required

1. Laptop or Desktop

2. Linux OS (I Prefer Fedora)

3. NormalBrain

Step 2: 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

Step 3: How to Begin

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

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions