# Basic Calculator

```import 'dart:io';//1
main(List<String>list)
{
print("Enter Two Numbers");//2
print("Enter your choice\n A for Addition \n S for Subtraction \n M for Multiply \n D for Division");//5
var result = " ";//7
switch(userchoice)//8
{
case "A":
case "a":
break;
case "S":
case "s":
result = "Subtraction of \$number1-\$number2=\${number1-number2}";//10
break;
case "D":
case "d":
result = "Division of \$number1/\$number2=\${number1/number2}";//11
break;
case "M":
case "m":
result = "Multiplication of \$number1*\$number2=\${number1*number2}";//12
break;
default:
result="Sorry! You Entered wrong choice";//13
break;

}
print(result);//14

}
```
1. import statement for input and out-stream lib for Dart
2. Instruct to user enter two number
3. Take user input and convert into double and assign to number1
4. Take second user input and convert into double and assign to number2
5. Instruct to the user for choosing their operator to perform calculations on numbers
6. Assign your choice into userchoice variable
7. Create result var with a blank string
8. Apply switch case for userchoice
9. if userchoice “A” or “a” then Addition is performed and assigned to result
10. if userchoice “S” or “s” then subtraction is performed and assigned to result
11. if userchoice “D” or “d” then Division is performed and assigned to result
12. if userchoice “M” or “m” then Multiplication is performed and assigned to result
13. if userchoice other than given choices then sorry massage assigned to result
14. The calculation result is printed on Command prompt

Output

Enter Two Numbers
10
5
S for Subtraction
M for Multiply
D for Division
A

Enter Two Numbers
50
90
S for Subtraction
M for Multiply
D for Division
S
Subtraction of 50.0-90.0=-40.0

Enter Two Numbers
67
5
S for Subtraction
M for Multiply
D for Division
M
Multiplication of 67.0*5.0=335.0

Enter Two Numbers
56
7
S for Subtraction
M for Multiply
D for Division
d
Division of 56.0/7.0=8.0

Enter Two Numbers
56
3