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
Zinaida [17]
3 years ago
7

Write a C program that does the following: Creates a 100-element array, either statically or dynamically Fills the array with ra

ndom integers between 1 and 100 inclusive Then, creates two more 100-element arrays, one holding odd values and the other holding even values (copied from the original array). These arrays might not be filled completely. Prints both of the new arrays to the console.
Computers and Technology
1 answer:
ANEK [815]3 years ago
5 0

Answer:

Following are the code to this question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

   int axb[100];//defining 1-array of 100 elements

   int odd_axb[100], even_axb[100];//defining two array that holds 100-elements

   int i,size=0,size1=0;

   for(i = 0; i < 100; i++)//defining for loop to assign value in array

   {

       axb[i] = rand() % 100 + 1;//using rand method to assign value with random numbers between 1 and 100

   }

   for(i = 0; i < 100; i++)//defining for loop that seprates array value in odd and even array

   {

       if(axb[i] % 2 == 0)//checking even condition  

       {

           even_axb[size++] = axb[i];//holding even number

       }

       else//else block

       {

           odd_axb[size1++] = axb[i];//holding Odd number

       }

   }

   //printing values

   cout << "Odd array: ";//print message  

   for(i = 0; i <size1; i++)//use for loop for print odd numbers

   {

   cout << odd_axb[i]<<" ";//printing values

   }

   

   cout <<"\n\n"<< "Even array: ";//print message

   for(i = 0; i <size; i++)//use for loop for print even_axb numbers

   {

       cout << even_axb[i] << " ";//printing values

   }

   return 0;

}

Output:

Odd array: 87 87 93 63 91 27 41 27 73 37 69 83 31 63 3 23 59 57 43 85 99 25 71 27 81 57 63 71 97 85 37 47 25 83 15 35 65 51 9 77 79 89 85 55 33 61 77 69 13 27 87 95  

Even array: 84 78 16 94 36 50 22 28 60 64 12 68 30 24 68 36 30 70 68 94 12 30 74 22 20 38 16 14 92 74 82 6 26 28 6 30 14 58 96 46 68 44 88 4 52 100 40 40

Explanation:

In the above-program, three arrays "axb, odd_axb, and even_axb" is defined, that holds 100 elements in each, in the next step, three integer variable "i, size, and size1" is defined, in which variable "i" used in the for a loop.

In the first for loop, a rand method is defined that holds 100 random numbers in the array, and in the next, for-loop a condition statement is used that separates even, odd number and store its respective array, and in the last for loop, it prints its store values  

You might be interested in
4.11 lesson practice edhesive
spin [16.1K]

Answer:

the last one

Explanation:

6 0
2 years ago
Read 2 more answers
Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printed line, print t
geniusboy [140]

Answer:

Please find the answer below

Explanation:

// Online C compiler to run C program online

#include <stdio.h>

int main() {

   // Write C code here

   //printf("Hello world");

   int userNum;

   int i;

   int j;

   

   scanf("%d", &userNum);

   /* Your solution goes here */

   for(i = 0; i<=userNum; i++){

       for(j = 0; j <= i; j++){

           printf(" ");

       }

       printf("%d\n", i);

   }

   return 0;

}

8 0
2 years ago
A medical assistant at a local hospital is exploring the Start Menu of his/her computer and various Windows programs/application
Ratling [72]
<span>Five questions that people are most likely to ask about the application are as follows:1. What is the use and function of this application?. 2. Who is this application for? 3. How much does this application cost?. 4. Where can the application been used? and 5. Why should I use this application? </span>
7 0
3 years ago
What feature did the 32X add to the Sega Genesis?
il63 [147K]

Answer:

ngl why would i know this

Explanation:

5 0
3 years ago
Where does append add the new elements?
ZanzabumX [31]

Answer:

"Option 1: To the end of an array." is the correct answer.

Explanation:

The word "Append" means adding to the end of a document.

Appending means whatever new content is added, it is added at the end of the document or data structure.

Similarly,

Appending an array means adding new elements to the end of the array.

Hence,

"Option 1: To the end of an array." is the correct answer.

7 0
3 years ago
Other questions:
  • You work administrative assistant in an engineering firm. A co-worker constantly makes fun of the engineers by whispering commen
    13·1 answer
  • The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per se
    9·1 answer
  • Write a function similar to keep_ints like before, but now it takes in a number n and returns a function that has one parameter
    8·1 answer
  • Write a program that continually prompts the user for an integer input until input is entered that is less than 0. Each input th
    9·1 answer
  • software that provides capabilities common across all organizations and industries is known as ________ software.
    15·2 answers
  • In 1-2 sentences, describe some keyboard shortcuts you have used during this lesson to save you time.
    13·2 answers
  • Simplify 0.2×0.03055 to 3 decimal places​
    15·2 answers
  • Is Brainly cheating??
    10·2 answers
  • What would a system unit that is integrated with the display and keyboard would be considered?
    6·1 answer
  • what is the term for software that is exclusively controlled by a company, and cannot be used or modified without permission?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!