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
tekilochka [14]
3 years ago
6

Write program to read 10 random numbers, then find how many of them accept division by 4,

Computers and Technology
1 answer:
telo118 [61]3 years ago
3 0

Answer:

In Python:

import random

di4 = 0; di5 = 0; di6 = 0

for i in range(10):

   num = random.randint(1,100)

   if num%4 == 0:

       di4+=1

   if num%5 == 0:

       di5+=1

   if num%6 == 0:

       di6+=1

print("There are "+str(di4)+" numbers accept division by 4")

print("There are "+str(di5)+" numbers accept division by 5")

print("There are "+str(di6)+" numbers accept division by 6")

Explanation:

This imports the random module

import random

This initializes the count of division by 4, 5 or 6 to 0

di4 = 0; di5 = 0; di6 = 0

This iteration is repeated 10 times

for i in range(10):

This generates a random number

   num = random.randint(1,100)

Check if number is divisible by 4. If yes, increase div4 by 1

<em>    if num%4 == 0:</em>

<em>        di4+=1</em>

Check if number is divisible by 5. If yes, increase div5 by 1

<em>    if num%5 == 0:</em>

<em>        di5+=1</em>

Check if number is divisible by 6. If yes, increase div6 by 1

<em>    if num%6 == 0:</em>

<em>        di6+=1</em>

Print reports

<em>print("There are "+str(di4)+" numbers accept division by 4")</em>

<em>print("There are "+str(di5)+" numbers accept division by 5")</em>

<em>print("There are "+str(di6)+" numbers accept division by 6")</em>

You might be interested in
Who watched Unus Annus??? (If you did what was your favorite part?​
quester [9]

This video was completeley unedited was a banger, and so was the vid where they made robot amy. that was hilarious.

But since it is now Post Mortem all say here is...

Unas Annus. Memento Mori.

It sure was fun.

3 0
3 years ago
Vinton cerf has been called one of main fathers of the internet. what internet organizations did he chair or help found? what in
Strike441 [17]
<span>He served from 2000-2007 as chairman of the board of the Internet Corporation for Assigned Names and Numbers (ICANN), an organization he helped form. </span>Cerf<span> is the co-designer of the TCP/IP protocols and the architecture of the </span>Internet<span>.</span>
5 0
3 years ago
Really desperate!
bija089 [108]

Answer: Sorry to break this to you but you can't.

Explanation:

7 0
3 years ago
Read 2 more answers
An independent computer program that copies itself from one computer to another over a network is called a ____:
Komok [63]
The answer is trojan horse.
4 0
4 years ago
What is the output of code corresponding to the following program segment if ?
wolverine [178]

Answer:

a. You are eligible to vote.

Explanation:

If Age >= 18 Then

Write "You are eligible to vote."

Else

Set - Age

Write "You can vote in " + Years + " years."

End If

The above code block is an example of if-else code block. The if-else code block follow a pattern of:

If (expression) then

else

(expression)

end if

Based on the if Age>= 18 condition, the output will be "You are eligible to vote."

4 0
3 years ago
Other questions:
  • One purpose of the dual ignition system on an aircraft engine is to provide for?
    7·2 answers
  • Robert needs to apply formatting from one set of text to multiple other sets of text throughout the document. Which option shoul
    7·1 answer
  • your browsing the internet and realize your browser is not responding. which of the following will allow you to immediately exit
    10·1 answer
  • While interoperability and unrestricted connectivity is an important trend in networking, the reality is that many diverse syste
    12·1 answer
  • An image can be copied from the Internet or another location and pasted into Paint.
    13·1 answer
  • Decrypt this message: P ht uva h zwf
    13·1 answer
  • In order to get the maximum functionality out of a device that is plugged in, a user should download the specific ___ for that d
    10·2 answers
  • What are some things you think are worthwhile and are willing to work harder to accomplish? Check all that apply.
    5·1 answer
  • What is this on g00gel Document, and how do I fix it?
    10·2 answers
  • You have recently compiled a custom Linux kernel. You notice some performance issues with and need to use the kernel log files t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!