#!/usr/bin/perl print"###simple calculator program##\n\n"; until ($opt2 eq'y') { print "enter the first number\n"; $num1=<>; print "enter the second number\n"; $num2=<>; print "enter your option\n\+ for addition\n\- for subtraction\n\* for +multiplication\n\/ for divison\n option:"; $opt=<>; chomp($opt); if ($opt eq'+') { print "you pressed the \+key\n press any key to continue\n"; <>; $ans=$num1+$num2; print "the answer is $ans\n"; } elsif ($opt eq'-') { print "you pressed the \-key\n press any key to continue\n"; <>; $ans=$num1-$num2; print "the answer is $ans\n"; } elsif ($opt eq'*') { print "you pressed the \*key\n press any key to continue\n"; <>; $ans=$num1*$num2; print "the answer is $ans\n"; } elsif ($opt eq'/') { print "you pressed the \/key\n press any key to continue\n"; <>; $ans=$num1/$num2; print "the answer is $ans\n"; }else { print "you have entered wrong option\n"; } print " do you want to continue press y or n?\n"; $opt2=<>; }else { print "thanks for using\n"; } <>;
In reply to help me to find out the error?? by dacka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |