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
zloy xaker [14]
2 years ago
15

Write a program that generates 100 random numbers and keeps a count of how many of those random numbers are even and how many of

them are odd.
Computers and Technology
1 answer:
Anvisha [2.4K]2 years ago
8 0

Answer:

import random

numbers = []

even = 0

odd = 0

for i in range(100):

   numbers.append(random.randint(1, 200))

for i in range(100):

   if numbers[i] % 2 == 0:

       even += 1

   else:

       odd += 1

print("Even:", even)

print("Odd:", odd)

Explanation:

Gg ez.

You might be interested in
1.Write a Java program to solve the following problem using modularity. Write a method that rotates a one-dimensional array with
Westkost [7]

Answer:

Explanation:

The following code is written in Java and it asks the user for the size of the array. Then it randomly populates the array and prints it. Next, it rotates all the elements to the right by 1 and prints the new rotated array.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Random;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Random r = new Random();

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Size of the Array: ");

       int arraySize = in.nextInt();

       ArrayList<Integer> myList = new ArrayList<>();

       for (int x = 0; x < arraySize; x++) {

           myList.add(r.nextInt(15));

       }

       System.out.println("List Before Rotation : " + Arrays.toString(myList.toArray()));

       for (int i = 0; i < 1; i++) {

           int temp = myList.get(myList.size()-1);

           for (int j = myList.size()-1; j > 0; j--) {

               myList.set(j, myList.get(j - 1));

           }

           myList.set(0, temp);

       }

       System.out.println("List After Rotation :  " + Arrays.toString(myList.toArray()));

   }

}

6 0
2 years ago
If an if- else statement is true, it will include which kinds of results?
Salsk061 [2.6K]

In an if...else statement, if the code in the parenthesis of the if statement is true, the code inside its brackets is executed. But if the statement inside the parenthesis is false, all the code within the else statement's brackets is executed instead.

Of course, the example above isn't very useful in this case because true always evaluates to true. Here's another that's a bit more practical:

#include <stdio.h>

int main(void) {

int n = 2;

if(n == 3) { // comparing n with 3 printf("Statement is True!\n");

}

else { // if the first condition is not true, come to this block of code

printf("Statement is False!\n"); } return 0;

}

Output:

Statement is False!

5 0
3 years ago
What is a nonimpact printer that creates characters and images with dots by using a drum and toner called?
rusak2 [61]

The answer is Laser Printer.  It is a non impact printer that creates characters and images with dots by using a drum and toner.  The main advantages of laser printers are speed, precision and economy. A laser can move very quickly, and because the laser beam has an unvarying diameter, it can draw more precisely, without spilling any excess ink.

5 0
2 years ago
You can choose to use a window manager only, and not use a desktop manager.
egoroff_w [7]
This seems more of a statement then a question if theres more id like to help
6 0
3 years ago
Read 2 more answers
How do you open the two versions of internet explorer 10?
Crank
On which windows it's not hard just search it google i would help but i hadn't used computer since may
5 0
3 years ago
Other questions:
  • Easy question how the internet has impacted y’all life
    13·1 answer
  • What part of a file name does windows use to know which application to open to manage the file?
    13·2 answers
  • Which of the following is an example of constructive criticism for a friend who speaks too softly?
    13·2 answers
  • If you are logged on to Windows Live Messenger, why would you be unable to engage
    6·1 answer
  • Choose the answer. Janice's IT department found that her computer had a program on it that was collecting her personal informati
    5·1 answer
  • A customer would like you to install a high-end video card suitable for gaming. Your installation and configuration SHOULD inclu
    7·1 answer
  • Describe how you would create a Java program that prompted the user to correctly enter a username and password. The username is
    7·1 answer
  • Political parties to address the interest of civil society<br>​
    7·1 answer
  • In a program you need to store identification numbers of 5 employees and their weekly gross pay.
    11·1 answer
  • Consider the following implementation of a search method:
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!