Given an Integer as an Input Write a Program to Print That Integer

In this article you will learn how to accept an integer variable from the user  using the input function call and then print the integer variable to standard output.

Let us try to solve this using the Python program.

 

 

Given an Integer as an Input, Write a Program to Print That Integer

 


 

Given an Integer as an Input, Write a Program to Print That Integer

This is a simple example to demo the usage of input() function call and the print() function call.  input() function call  is used to get the input from the standard input,  output() function call is used to print the data to standard output.

Take integer variables named as numbers, using the input function call, ask the user to enter an integer number and then convert it into an int() using the type conversion function call.

number = int(input("Enter a Number :"))

print(f"The Integer Value Your Entered is : {number}")


Python Program
=======================

number = int(input("Enter a Number :"))

print(f"The Integer Value Your Entered is : {number}")






Output
==============
Enter a Number :55
The Integer Value Your Entered is : 55





 Output
==============
Enter a Number :-45
The Integer Value Your Entered is : -45





Output
==============
Enter a Number :0
The Integer Value Your Entered is : 0




Output
==============
Enter a Number :1234
The Integer Value Your Entered is : 1234





Conclusion
==================
Execute the above Python program by providing random integer values as an input and note down the integer as output.

Comment it down  below if you have any queries related to above Python program





Post a Comment

0 Comments