Read Mode
Default

Add two numbers Entered by user [Beginner]

Add two numbers Entered by user
Preview

Adding two numbers is not a difficult task, but what if you can make a computer understand that "I need to add these numbers, Do it for me." This experience of making someone work according to you makes you feel like a leader or else. Let's learn that "How can you make a computer add two numbers, that you'll provide to it."

We are going to do it in a computer programming language called "Batch". No need of downloading any new software or compiler. Just open your Notepad and Copy paste the Code given below; or You can simply Download the prepared File from the Link given at the Bottom of this Article.

The Code so easy, that I think that there is no need of explanation of it, But in case you don't understand that what is this Shit!! Just try to read My Book, Batch Programming Decoded. It is short and simple book which will definately help you in understanding and learning batch programming easily.


----------Code Starts----------

@echo off
cls
title Add two Numbers !
echo.
set /p a=Enter First number :
if not defined a (goto error)
set /p b= ENter Second Number :
if not defined b (goto error)
set /a c=%a%+%b%
echo.


echo. Result is %c%.
goto end
:error
cls
echo. Field Can't be empty.....
pause
goto end
:end
exit
::by kvc
:: Contact me "karanveerchouhan@gmail.com"



----------Code Ends----------


Download Link: Add.bat

#TheBATeam

No comments:

Powered by Blogger.