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
KonstantinChe [14]
2 years ago
10

Write a function that accepts a positive random number as a parameter and returns the sum of the random number's digits. Write a

program that generates random numbers until the sum of the random number's digits divides the random number without remainder. assembly language
Computers and Technology
1 answer:
Luba_88 [7]2 years ago
4 0

Answer:

Explanation:

The following Python program has a function called addDigits which takes a number as a parameter and returns the sum of the digits. Then the program creates a loop that keeps creating random numbers between 222 and 1000 and divides it by the value returned from the function addDigits. If the remainder is 0 is prints out a statement and breaks the loop, ending the program. The picture below shows the output of the program.

import random

def addDigits(num):

   sum = 0

   for x in str(num):

       sum += int(x)

   return sum

sum = addDigits(random.randint(222, 1000))

while True:

   myRandomNum = random.randint(2, 99)

   if (sum % myRandomNum) == 0:

       print("No remainder between: " + str(sum) + " and " + str(myRandomNum))

       break

You might be interested in
What type of encoding is this?<br>0x6a656c6c7966697368<br>cause I'm trying to decode it
katen-ka-za [31]
According to its structure I'd say that this is SEAL (<span>Software-Optimized Encryption Algorithm). It's difficult to describe how it works, because this kind of ciphers is very tricky. This algorithm uses 160 bit key and it uses 3 tables (R, S, T) to encode and decode.

I'll attach the image where you can see a process of creating a pseudo-random function:
</span>

7 0
3 years ago
What is the type of data in the list [103, 405, 527, 396, 503]?
Mariulka [41]

Answer:

alphanumeric.........

3 0
2 years ago
Read 2 more answers
Help<br> pls need quickly
g100num [7]

Answer:

Themes

Explanation:

  1. In the slide thumbnail pane on the left, select a slide.
  2. On the Design tab, in the Themes group, click the More button (illustrated below) to open the entire gallery of themes:
  3. Point the mouse at the theme you want to apply. Right-click it, and then select Apply to All Slides.
3 0
2 years ago
What is the basic process of programming?
NikAS [45]

Answer:

There are usually three stages to writing a program: Coding. Compiling. Debugging.

8 0
2 years ago
A short circuit locator should be periodically run along the cords used in a shop to check for shorts and open circuits. A.)True
masya89 [10]

The answer is,  A) True

5 0
3 years ago
Read 2 more answers
Other questions:
  • In poor weather , you should ___ your following distance.
    12·1 answer
  • Di bawah ini tampilan submenu pada tab menu insert pada microsoft word 2010,yaitu...
    6·1 answer
  • A ____ is a data network connection that makes use of the public telecommunications infrastructure but maintains privacy through
    13·1 answer
  • Write the definition of a function printDottedLine, which has no parameters and doesn't return anything. The function prints to
    10·1 answer
  • HELP ME PLZ QUICK Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took
    11·1 answer
  • What should be included in research for a problem statement? Select all that apply
    13·2 answers
  • Emma lives in Pennsylvania, what climate does she live in?
    7·1 answer
  • To use   ( 2 complement ) answer it (101101)2 – (1100)2 =   (                    )2
    12·1 answer
  • In which program structure does the processor verify the mentioned condition only after executing the dependent statements once?
    8·2 answers
  • Write a program that first reads a list of 5 integers from input. Then, read another value from the input, and output all intege
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!