1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PolarNik [594]
3 years ago
10

4. Write an interactive program CountOddDigits that accepts an integer as its inputs and prints the number of even-valued digits

in that number. An even-valued digit is either 1, 3, 5, 7, or 9. For example, the number 8546587 has four even digits (the two 5s, and a 7). So the program CountOddDigits(8546587) should return "The number of Odd Digits in 8546587 is 3".
Computers and Technology
1 answer:
levacccp [35]3 years ago
4 0

Answer:

Program :

number=int(input("Enter the number: "))#take the input from the user.

number1=number

count=0#take a variable for count.

while(number>0):#loop which check every number to be odd or not.

   value=number%10 #it is used to take the every number from integer value.

   number=int(number/10)#it is used to cut the number which is in the use.

   if(value%2!=0):#It is used to check the number to be odd.

       count=count+1#It is used to increase the value.

print("The number of Odd Digits in "+str(number1)+" is "+str(count))#It is used to print the count value of odd digit.

Output:

  • If the user inputs is '1234567890', it will prints "5".
  • If the user inputs is "8546587", it will prints "3".

Explanation:

  • The above program is in python language, which takes the integer value from the user.
  • Then The number will be distributed into many individual units with the help of a while loop.
  • The while loop runs when the number is greater than 0.
  • There is a two operation, one is used to take the number by the help of modulo operator because it gives the remainder.
  • The second operation is used to divide the number to let the number 0.
You might be interested in
Sally is editing her science report about living things. She needs to copy a paragraph from her original report. Order the steps
Gemiola [76]
First, Sally needs to highlight the report by holding down the left click button on her cursor/mouse. Then she will right click with her cursor and click “Copy”. Then, Sally will go to the empty document and right click again. This time she will press “Paste” and the report will appear on the empty document.
4 0
4 years ago
What is the danger in judging someone according to his or her social networking profile
AfilCa [17]
They could find you and throw hands.
8 0
3 years ago
Which of the following might a small local bakery hire a multimedia artist to do? (Select all that apply).
Temka [501]

Answer:

B and C

Explanation:

Multimedia artists create art, they do not program or do the cooking for the business.

7 0
3 years ago
1-5. Discuss briefly the function and benefits of computer network. (5pts​
Elden [556K]

Computer networks allow an unlimited amount of computers to communicate with each other. This is especially useful in enterprise environments, as technicians have to deal with hundreds of computers at a time. Computer networks make it easier to share files, increase storage capacity, better communication, easier to to control computers remotely, easier to share resources, ability to share a single internet connection on multiple devices. Computer networks also have a lot of cost benifits too, as network administration is centralised, meaning that less IT support is required, and you can cut costs on sharing peripherals and internet access.

Hopefully this helps you out!

7 0
3 years ago
Design and implement an algorithm that gets as input a list of k integer values N1, N2,..., Nk as well as a special value SUM. Y
satela [25.4K]

Answer:

Follows are the code to this question:

def FindPair(Values,SUM):#defining a method FindPair  

   found=False;#defining a boolean variable found

   for i in Values:#defining loop for check Value  

       for j in Values:#defining loop for check Value

           if (i+j ==SUM):#defining if block that check i+j=sum

               found=True;#assign value True in boolean variable

               x=i;#defining a variable x that holds i value

               y=j;#defining a variable x that holds j value

               break;#use break keyword

       if(found==True):#defining if block that checks found equal to True

           print("(",x,",",y,")");#print value

       else:#defining else block

           print("Sorry there is no such pair of values.");#print message

Values=[3,8,13,2,17,18,10];#defining a list and assign Values

SUM=20;#defining SUM variable

FindPair(Values,SUM);#calling a method FindPair

Output:

please find the attachment:

Explanation:

In the above python code a method, "FindPair" is defined, which accepts a "list and SUM" variable in its parameter, inside the method "found" a boolean variable is defined, that holds a value "false".

  • Inside the method, two for loop is defined, that holds list element value, and in if block, it checks its added value is equal to the SUM. If the condition is true, it changes the boolean variable value and defines the "x,y" variable, that holds its value.
  • In the next if the block, it checks the boolean variable value, if the condition is true, it will print the "x,y" value, otherwise, it will print a message.  

6 0
3 years ago
Other questions:
  • What are some tasks Petroleum Engineers perform?
    5·2 answers
  • The air in the atmosphere circulates mainly because _____.
    7·2 answers
  • What are computers used for?
    14·2 answers
  • A tripod head can move vertically or horizontally. What term describes these movements?
    15·2 answers
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • What do people in japan use to make anime
    5·1 answer
  • What is the central idea of the second section:
    14·1 answer
  • What are 3 software programs for mobile computing?
    10·1 answer
  • What is the function of ROM?
    10·1 answer
  • Which tool might be useful if you want to design a scratch game for preschoolers that avoids asking them to read instructions
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!