...

/

Entering Data from the Keyboard

Entering Data from the Keyboard

In this lesson, we will learn about getting data from the user.

Sometimes while we are writing a program, we may want to take input from the user who is actually using our program. We design tasks so that they run on any input that the user may give.

Take the example of a calculator. We put some input into it and tell it what to do with the input. It performs the respective task and displays the result.

Now suppose we are also creating a calculator that performs only addition.

Let’s have a look at an example:

Taking user's input and passing to a function.
Taking user's input and passing to a function.

In the illustration, above we take two inputs from the user, perform a certain task on it and then display the result on the ...