Write a program that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical. Ex: If the input is: 93 the output is: 93 92 91 90 89 88 Ex: If the input is: 11 the output is: 11 Ex: If the input is: 9 or any value not between 11 and 100 (inclusive), the output is: Input must be 11-100   this is what i have n = int(input()) if n > 100 or n < 11: print('Input must be 11-100') exit(0) while True: print(n, end=" ") first_digit = n // 10 second_digit = n % 10 if first_digit == second_digit: break n = n-1 my output is 93 92 91 90 89 88 but it needs to be 93 92 91 90 89 88

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter5: Making Decisions
Section: Chapter Questions
Problem 4PE
icon
Related questions
Question
100%

Write a program that takes in an integer in the range 11-100 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.

Ex: If the input is:

93

the output is:

93

92

91

90

89

88

Ex: If the input is:

11

the output is:

11

Ex: If the input is:

9

or any value not between 11 and 100 (inclusive), the output is:

Input must be 11-100

 

this is what i have

n = int(input())
if n > 100 or n < 11:
print('Input must be 11-100')
exit(0)

while True:
print(n, end=" ")

first_digit = n // 10
second_digit = n % 10

if first_digit == second_digit:
break

n = n-1

my output is 93 92 91 90 89 88

but it needs to be

93

92

91

90

89

88

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT