missions Remaining: 3
[M2 P2] 'Good' numbers - 'Bad' numbers
We start with a two-digit positive integer and construct a program
sequence of two-digit numbers as follows. Let the current
number be x. If 2x is less than 100, then the next number in
the sequence is 2x. Otherwise, the next number in the
sequence is 2*x - 100.
A number is said to be good if we can start with the number
and get back to the same number later in the sequence. A
number is said to be bad if it is not good!
For example:
1. 20 is a good number, because the sequence starting with
20 is 20, 40, 80, 60, 20. So, after four steps, we get
back to 20.
2. 10 is bad because starting from 10 we get the sequence
10, 20, 40, 80, 60, 20, ... in which 10 never appears
again.
Write a program that takes the value of positive integer N and
outputs the sum of the first N good numbers.
Constraints:
0 <N< 20
Answers
Answered by
0
Answer:
bvfgfrfcb need need ll bicycle xii
Answered by
0
Answer:
In which class do you read
Similar questions