When i execute my program and put in something like 1280000000*20 it gives me -169803776 when it should be 25600000000, when i then try 25600000000/20 it gives me -1698037766 which is different. This shows there is something wrong with my calculator because the laws of maths say when a*b=c, b/c=a which isnt true in this situation. The calculations are also incorrect.
I've tried putting the same code into python (different language) and it works fine so i think its something to do with batch itself.
echo off
cls
:start
cls
echo Welcome to the calculator
echo.
echo Choose one of the of the following
echo.
echo 1. Multiplication
echo 2. Division
echo.
set /p choose=Choose a number:
IF %choose%==1 (
goto multiply
) ELSE IF %choose%==2 (
goto divide
) ELSE (
goto error
)
:error
cls
echo THAT ISNT AN OPTION!!
echo.
pause
goto start
:multiply
cls
echo Pick 2 numbers to multiply
echo.
set /p a=Number 1:
set /p b=Number 2:
set /a c=%a%*%b%
cls
echo %a% x %b% = %c%
pause
goto start
:divide
cls
echo Pick 2 numbers to divide
echo.
set /p a=Number 1:
set /p b=Number 2:
set /a c=%a%/%b%
cls
echo %a% / %b% = %c%
pause
goto start
I expect the output of 1280000000*20=25600000000, but the actual output is -169803776. This number changes every time to a negative for some reason.