Computer Science

The digits 0, 1, and 8 look much the same if rotated 180 degrees on the page (turned
upside down). Also, the digit 6 looks much like a 9, and vice versa, when rotated 180
degrees on the page. A multi-digit number may also look like itself when rotated on the
page; for example 9966 and 10801 do, but 999 and 1234 do not.
You are to write a program to count how many numbers from a given interval look like
themselves when rotated 180 degrees on the page. For example, in the interval [1..100]
there are six : 1, 8, 11, 69, 88, and 96.
Your program should take as input two integers, m and n, which define the interval to be
checked, 1 ≤ m ≤ n ≤ 32000. The output from your program is the number of rotatable
numbers in the interval.
You may assume that all input is valid.
Input/output is not from/to files for this question. Keyboard input and screen output is
Sample Session User input is in italics.
Enter the lower bound of the interval:
Enter the upper bound of the interval:
The number of rotatable numbers is:

I am kind of stuck withe logic... help me please.

No one has answered this question yet.

  1. 👍 0
  2. 👎 0
  3. 👁 218
  1. See response at

    1. 👍 0
    2. 👎 0

Respond to this Question

First Name

Your Response

Similar Questions

  1. algebra

    Are these correct?! 1. Samantha drew Δ JKL with the coordinates (2, 3), (4, 3), and (5, 2). She reflected this triangle over the x-axis to create an image. What are the coordinates of the image? A. (0, 3), (2, 3), and (3, 2) B.

  2. Math

    Triangle ABC has vertices A (-4,-2), B (-1,3), and C (5,0). Triangle ABC is rotated 180 degrees counterclockwise about the origin to form triangle A'B'C'. a. what are the coordinates of the vertices of triangle A'B'C'? b. How

  3. Math

    i need my answers checked please :) Every which way quiz for connexus 8th grade 1. Samantha drew Δ JKL with the coordinates (2, 3), (4, 3), and (5, 2). She reflected this triangle over the x-axis to create an image. What are the

  4. CHEM

    What are the expected bond angles in ICl4+ (or) ICl_4^+ ?? I think that I have the stucture drawn correcty: I is the central atom with one lone pair above it. I then have the Cl's with 6dots around them & then bonded, singly, to

  1. math

    Tyler used 2989 digits to number the pages of a book. How many pages does the book have? I know that pages 1-9 use 1 digit, total number is 9 Pages 10-99 use 2 digits, total number is 180 Pages 100-999 use 3 digits, 900 pages=

  2. geometry

    In the English alphabet, there are 7 capital letters that look the same after being rotated 180∘. Those letters are H, I, N, O, S, X, and Z. How many different 3 letter "words" can be made from these letters such that when the

  3. Physics

    Five Forces act on an object: 1. 60 N at 90 degrees 2. 40 N at 0 degrees 3. 80 N at 270 degrees 4. 40 N at 180 degrees 5. 50 N at 60 degrees What are the magnitude and direction of a sixth force that would produce equilibrium?

  4. math

    a segment of late 94 cm has been rotated d degrees around a center zero what is the length of the rotated segment

  1. Math

    which of the following angles, when placed in standard position, does not land in quadrant III? A. 180 degrees B. -179 degrees C. 145 degrees D. -97 degrees Stuck can someone please help me?

  2. Maths

    The bearing of A from B is 060 degrees. What is the bearing of B from A? Is it: a) 60 degrees b) 240 degrees c) 120 degrees d) 200 degrees p.s. The questions I sent earlier was an acccident To get reciprocal bearings, add 180

  3. precalculus

    Solve tan theta = sqrt 3 where 180

  4. MATH

    Find 3 upper case letters that look the same when rotated 180 degrees. Then, what letter's 90, 180, and 270 degree rotations has this outline? This is also the inside lines formed by the rotation of what letter? and could explain

You can view more similar questions or ask a new question.