Program to Print a Number
Write A program that gets an integer number randomly from (0 to 9), and outputs the number and the same number again a number of times corresponding to the given number like shown below. Output: (7 is printed 7 times) 7 7777777
Answers
Answered by
0
here... we should print the given number first and then the particular number of times...
Attachments:
Answered by
0
Python Program :
Explanation:
number=int(input("Enter the number from 0 to 9: ")) #Take the input from the user.
if number>=0 and number<=9:#if condition to be test the number is in 0 to 9 or not.
for x in range(number):#for loop to print the number.
print(number,end="")
else:
print("The number must be in between 0 to 9")
Output :
- If the user input as 2, then the output is 22.
- If the user input as 0, then the output is nothing.
Code Explanation:
- The above code is in python language, which holds one for loop which runs from 0 to input value.
- Then the number is printed on the number of times.
Learn More :
- Python : https://brainly.in/question/14689905
Similar questions