subject

Count operation Lucky twos Lucky Twos determines and displays the number of digits that are 2s in a whole number. For example, the number of 2s in 3487 is 0, while the number of 2s in 272521 is 3. Note: whole numbers are non-negative integers starting at zero 0, 1, 2, 3, 4.
Assume that the fractional part is discarded in the division:
10 / 4 = 2
8 / 5 = 1
20 / 3 = 6
Read number
set count to 0
while number > 0
If the number module 10 is Then add
1 to count
End If
Compute number as number / 10
End while
Display count.
Let n be the number of digits of the whole number. What is the number of operations that are executed in the code in terms of n?

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 03:30, glitch14
It is not necessary to develop strategies to separate good information and bad information on the internet. true or false
Answers: 1
image
Computers and Technology, 24.06.2019 08:10, anthonysutton82
Where are american poets found in the dewey decimal system
Answers: 1
image
Computers and Technology, 24.06.2019 13:30, lorelaistudent
Does anybody know how to hack into a google account? i had important information on it and it is gone now and i need getting it back.
Answers: 1
image
Computers and Technology, 24.06.2019 17:40, HealTheWorld
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately
Answers: 2
You know the right answer?
Count operation Lucky twos Lucky Twos determines and displays the number of digits that are 2s in a...

Questions in other subjects:

Konu
Mathematics, 31.12.2019 06:31
Konu
Computers and Technology, 31.12.2019 06:31
Konu
Mathematics, 31.12.2019 06:31
Konu
Business, 31.12.2019 06:31