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
kirza4 [7]
3 years ago
9

LAB: Even/odd values in an array

Computers and Technology
2 answers:
forsale [732]3 years ago
7 0

Answer:

integers=[]

while True:

      number=int(input())

      if number<0:

       break

      integers.append(number)  

print("",min(integers))

print("",max(integers))Explanation:

Masja [62]3 years ago
4 0

Answer:

  1. #include <stdio.h>
  2. bool IsArrayEven(int inputVals[], int numVals){
  3.    int i;
  4.    for(i = 1; i < numVals; i++){
  5.        if(inputVals[i] % 2 != 0){
  6.            return false;
  7.        }
  8.    }
  9.    return true;
  10. }
  11. bool IsArrayOdd(int inputVals[], int numVals){
  12.    int i;
  13.    for(i = 1; i < numVals; i++){
  14.        if(inputVals[i] % 2 == 0){
  15.            return false;
  16.        }
  17.    }
  18.    return true;
  19. }
  20. int main()
  21. {
  22.     int my_input[] = {5, 2, 4, 6, 8, 10};
  23.     if(IsArrayEven(my_input)){
  24.         printf("all even");
  25.     }else if(IsArrayOdd(my_input)){
  26.         printf("all odd");
  27.     }else{
  28.         print("not even or odd");
  29.     }
  30. }  

Explanation:

Firstly, write two functions to check if the input array is all even or all odd (Line 3-22). The key idea is to use modulus operator to check if a number % 2 equal to 0, it is an even number, if not, it is an odd. So long as one of the number is odd in the isArrayEven function, the function shall return false (Line 7). If no odd value detected, it return true (Line 11). The similar code logic is applied to isArrayOdd function too.  

Then, we can call the two functions sequentially in the main program. If isArrayEven function return true, it display all even message (Line 28-29). If odd, display all odd (Line 30 -31). If neither, display not even or odd (Line 32-33).

You might be interested in
What kind of device should you install if you need the device to perform network address translation, facilitate access to the I
just olya [345]
The Correct Answer would Be A Router.
8 0
3 years ago
You are troubleshooting a cpu and have already cut power, disconnected the power cable, opened the case, and put on your antista
Nonamiya [84]
If you're aware that it is the CPU causing this problem, then you want to aim at the CPU fan, it is usually always on top of the CPU, once it is removed, take some time to know what socket you motherboard has, there are many types of sockets for both Intel and AMD  PC's the most common socket's for Intel is LGA1150 and for AMD it is either AM3/AM3+
3 0
3 years ago
Which of the following best define grit
andreyandreev [35.5K]

Definition of Grit. According to researchers at the University of Penn- sylvania, grit is defined as "perseverance and passion for long-term goals.” Grit involves working strenuously to- ward challenges, maintaining effort and interest over years despite failure, adversity, and plateaus in progress.

Hope This Helps!      Have A Nice Day!!

8 0
3 years ago
A place in memory who's contents cannot change while the program is running
maria [59]
Constant will be the answer
6 0
3 years ago
The PRODUCT table contains this column: PRICE NUMBER(7,2)
Anna35 [415]

SQL queries are used to return results from a database table or multiple tables.

If the PRICE column contains null values, then (b) the statement would fail because values cannot be divided by 0.

The query is given as: SELECT NVL(10 / price, '0')  FROM PRODUCT

From the query, the query is to first divide 10 by the value of the PRICE column.

If the PRICE column contains 0, then it means that price = 0

A division by 0 is not possible.

So, the query would fail

Hence, the true statement is (b)

Read more about SQL queries at:

brainly.com/question/15049854

7 0
2 years ago
Other questions:
  • . Consider the following brute-force algorithm for evaluating a polynomial. ALGORITHM Brute Force Polynomial Evaluation(P[0..n],
    14·1 answer
  • What is one course of action available in every problem solving process?
    9·2 answers
  • Fredrick wants to revise an employee policy. If he wants to inform all of the employees of the change, what type of document wil
    10·2 answers
  • Consider the problem of finding the distance between the two closest numbers in an array of n numbers. (The distance between two
    13·1 answer
  • ____ is designed for short-distance connections and has only a few lambdas, with a greater space between lambdas. Group of answe
    9·2 answers
  • Gwen's company is planning to accept credit cards over the Internet. Which one of the following governs this type of activity an
    13·1 answer
  • Your teacher needs to keep track of a biology experiment's results for all students, to
    7·2 answers
  • 15. Cinematic tutorials and action-movie camera shots mixed with gameplay and some of the features that have made _____ stand th
    11·1 answer
  • Raman will perform in pune tomorrow(simple past)​
    11·2 answers
  • True or False
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!