Read a Number

Aim:

To implement a program to read a number from user. 

 

Instructions:

  • Declare a variable n1 to hold the user input. 
  • Get the number from the user using input function. 
  • The default data type of the user input is string. So int() is used to convert the string type data into integer type. 
  • Finally print the user input in the console / screen. 

The program to read a number from user and its equivalent low-level instructions executed by the hardware. The low-level instructions used are: 

in It reads the input from the user and stores it in a variable. 
out It prints the output value to the screen.