批处理文件计算器除法余数
batch file calculator division remainder
@echo off
title My Simple Calculator
echo What is the First Number you would like to Divide?
set /p number1=
echo What is the Second Number you would like to Divide?
set /p number2=
Set /A result = %number1% / %number2%
echo The answer is %result%.
pause
你好。再会。只是想就此寻求一些帮助 matter.Since 我是编程的“新手”。主题是关于 CMD 脚本的。在我的简单计算器中,如何显示 remainder/s。提前谢谢你。
根据我的评论,以及在命令提示符下输入 Set /?
时提供的信息,您可以使用乘法和减法算术运算符进行分组:
@Echo Off
Title My Simple Calculator
Set /P "number1=What is the number you would like to divide? "
Set /P "number2=What number would you like to divide %number1% by? "
Set /A result=number1/number2
Set /A remainder=number1-(result*number2)
Echo The answer is %result%, with a remainder of %remainder%.
Pause
或者,您也可以使用模算术运算符,%
,(如果在批处理文件中使用而不是命令提示符,则需要加倍):
@Echo Off
Title My Simple Calculator
Set /P "number1=What is the number you would like to divide? "
Set /P "number2=What number would you like to divide %number1% by? "
Set /A result=number1/number2
Set /A remainder=number1%%number2
Echo The answer is %result%, with a remainder of %remainder%.
Pause
@echo off
title My Simple Calculator
echo What is the First Number you would like to Divide?
set /p number1=
echo What is the Second Number you would like to Divide?
set /p number2=
Set /A result = %number1% / %number2%
echo The answer is %result%.
pause
你好。再会。只是想就此寻求一些帮助 matter.Since 我是编程的“新手”。主题是关于 CMD 脚本的。在我的简单计算器中,如何显示 remainder/s。提前谢谢你。
根据我的评论,以及在命令提示符下输入 Set /?
时提供的信息,您可以使用乘法和减法算术运算符进行分组:
@Echo Off
Title My Simple Calculator
Set /P "number1=What is the number you would like to divide? "
Set /P "number2=What number would you like to divide %number1% by? "
Set /A result=number1/number2
Set /A remainder=number1-(result*number2)
Echo The answer is %result%, with a remainder of %remainder%.
Pause
或者,您也可以使用模算术运算符,%
,(如果在批处理文件中使用而不是命令提示符,则需要加倍):
@Echo Off
Title My Simple Calculator
Set /P "number1=What is the number you would like to divide? "
Set /P "number2=What number would you like to divide %number1% by? "
Set /A result=number1/number2
Set /A remainder=number1%%number2
Echo The answer is %result%, with a remainder of %remainder%.
Pause