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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:20
Write a program that prompts the user to input a string. the program then uses the function substr to remove all the vowels from the string. for example, if str = "there", then after removing all the vowels, str = "thr". after removing all the vowels, output the string. your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
Answers: 2
question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
The qwerty keyboard is the most common layout of keys on a keyboard
Answers: 3
question
Computers and Technology, 23.06.2019 00:00
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
You know the right answer?
Count operation Lucky twos Lucky Twos determines and displays the number of digits that are 2s in a...
Questions
question
Chemistry, 03.11.2020 18:20
question
Mathematics, 03.11.2020 18:20
question
Mathematics, 03.11.2020 18:20
question
Mathematics, 03.11.2020 18:20
question
History, 03.11.2020 18:20
question
Mathematics, 03.11.2020 18:20
question
Physics, 03.11.2020 18:20
question
English, 03.11.2020 18:20
Questions on the website: 13722361