Question #24114

create a batch file program that performs 4 mathematical operations such as addition, subtraction, multiplication and division.

Expert's answer

@echo off

set /p a=Enter a:

set /p b=Enter b:

set /a sum=%a%+%b%

echo a + b = %sum%

set /a difference=%a%-%b%

echo a - b = %difference%

set /a product=%a%*%b%

echo a * b = %product%

set /a quotient=%a%/%b%

echo a / b = %quotient%

pause

set /p a=Enter a:

set /p b=Enter b:

set /a sum=%a%+%b%

echo a + b = %sum%

set /a difference=%a%-%b%

echo a - b = %difference%

set /a product=%a%*%b%

echo a * b = %product%

set /a quotient=%a%/%b%

echo a / b = %quotient%

pause

Learn more about our help with Assignments: Programming & Computer Science

## Comments

## Leave a comment