Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :MENU
- REM Main Menu
- @echo off
- ECHO 1. Calculate Area of Circle
- ECHO 2. Calculate Area of Rectangle
- ECHO 3. Exit
- SET /P choice=Choose an option (1 or 2 or 3) :
- IF "%choice%"=="1" GOTO CIRCLE
- IF "%choice%"=="2" GOTO RECTANGLE
- IF "%choice%"=="3" GOTO EXIT
- :CIRCLE
- REM Area of Circle
- @echo off
- ECHO Area of Circle
- SET /P radius=Enter the radius of the circle:
- SET /A area=314*%radius%*%radius%/100
- REM The formula for the area of a circle is πr², where π is approximated as 3.14
- ECHO The area of the circle with radius %radius% is %area%.
- REM End of Area of Circle
- ECHO Press any key to continue...
- PAUSE > NUL
- CLS
- GOTO MENU
- :RECTANGLE
- REM Area of Rectangle
- @echo off
- ECHO Area of Rectangle
- SET /P length=Enter the length of the rectangle:
- SET /P width=Enter the width of the rectangle:
- SET /A area=%length%*%width%
- ECHO The area of the rectangle with length %length% and width %width% is %area%.
- REM End of Area of Rectangle
- ECHO Press any key to continue...
- PAUSE > NUL
- CLS
- GOTO MENU
- :EXIT
- REM Exit the script
- @echo off
- ECHO Exiting the program...
- ECHO Goodbye!
- EXIT /B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement