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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

In Coral Language

3.22 LAB: Loops: Countdown until matching digits

 

Write a program that takes in an integer in the range 20-98 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:

77

the output is:

77

Ex: If the input is:

9

or any number not between 20 and 98 (inclusive), the output is:

Input must be 20-98

For coding simplicity, follow each output number by a space, even the last one.

Use a while loop. Compare the digits; do not write a large if-else for all possible same-digit numbers (11, 22, 33, …, 88), as that approach would be cumbersome for large ranges.

 

20:39 Mon Dec 20
43%
Wk 4: Apply: Labs [due Day 7]
= zyBooks
My library > PRG/211: Algorithms And Logic For C. >
3.22: LAB: Loops: Countdown until matching digits
E zyBooks catalog
? Help/FAQ 8 John Tolentino
VVOUIU N T LUITIDTI SUITIE TUI Taiyo Tanyes.
371120.2321490.qx3zqy7
LAB
3.22.1: LAB: Loops: Countdown until matching digits
0/ 10
АCTIVITY
Load default template...
1 integer x
Variables
2
3 x = Get next input
Not shown when editing
4
5 if x >= 20 and x <=98
Put x to output
to output
7
Put
Input
%3D
8.
X = X
1
9
10
11
12
Output
13
14
15
Code
Flowchart
Execution speed
ENTER EXECUTION
STEF
RUN
Medium O
Submit for grading
Signature of your work
What is this?
12/14.. T---|0-
W-- M-- ..12/20
Transcribed Image Text:20:39 Mon Dec 20 43% Wk 4: Apply: Labs [due Day 7] = zyBooks My library > PRG/211: Algorithms And Logic For C. > 3.22: LAB: Loops: Countdown until matching digits E zyBooks catalog ? Help/FAQ 8 John Tolentino VVOUIU N T LUITIDTI SUITIE TUI Taiyo Tanyes. 371120.2321490.qx3zqy7 LAB 3.22.1: LAB: Loops: Countdown until matching digits 0/ 10 АCTIVITY Load default template... 1 integer x Variables 2 3 x = Get next input Not shown when editing 4 5 if x >= 20 and x <=98 Put x to output to output 7 Put Input %3D 8. X = X 1 9 10 11 12 Output 13 14 15 Code Flowchart Execution speed ENTER EXECUTION STEF RUN Medium O Submit for grading Signature of your work What is this? 12/14.. T---|0- W-- M-- ..12/20
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I'm getting an error that says unknown token near: ! = x%10. 
What's wrong with code?

Solution
Bartleby Expert
SEE SOLUTION
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY