Write a C program that does the following: Creates a 100-element array, either statically or dynamically Fills the array with random 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.

Answers

Answer 1

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  


Related Questions

Which statements about editing an existing Contact in Outlook are true? Check all that apply.

Double-click a contact to open the editing page.
Right-click a contact and click Edit to open the editing page.
Click the Edit link in the Contact Information page to open the editing page.
Contacts can be edited in the body of an email message.
Existing fields can be edited for a Contact in the editing page.
New fields can be added for a Contact on the editing page.

Answers

Answer:

Double-click a contact to open the editing page.

Right-click a contact and click Edit to open the editing page.

Click the Edit link in the Contact Information page to open the editing page.

Existing fields can be edited for a Contact in the editing page.

New fields can be added for a Contact on the editing page.

Explanation:

just did it

The following statements should be considered for editing into an existing contact in Outlook:

Double click the contact in order to open the editing page.Right-click the contact & click on edit to open the editing page.Click on the edit link in the page of contact information for editing the page.The fields that are existed could be altered for a contact in an editing page.The new fields for the contact on the editing page could be added.

The following information should be relevant:

The Contact & editing page is important.Contacts can't be added to the body of the email message.

Therefore we can conclude the above statements should be considered for altering an existing contact in outlook.

Learn more about the outlook here: brainly.com/question/20494929

6. Which is not considered a storage device a. USB Flash Drive b. External hard Drive c. MS-Windows d. Internal Hard Drive e. Memory Cards​

Answers

Answer:

MS-Windows

Explanation:

MS-Windows is an operating system not a storage device.

Which of these is NOT a mathematical operator used in Python?

A. !
B. /
C. %
D. *

Answers

the answer is A. i wouldn’t seen any mathematical question that has to do with “!”

ahmed is attending a conference and wants to learn more about python lists. Which conference is mostly likely to meet ahmed's needs

Answers

New Validation Methods  meets is most likely to suit Ahmed's requirements.

Define New Validation Methods ?

Python validation protects third-party users from mistakenly or maliciously misusing code. It may be used to determine whether or not the input data type is valid. It may be used to see if the provided input has any incorrect values. Validation may be classified into four types:

Validation in the future.

Validation at the same time.

Validation retroactively.

Revalidation (Periodic and After Change) (Periodic and After Change)

Learn more about Python validation from here;

https://brainly.com/question/21600820

#SPJ1

where did the command line first get its beginning?​

Answers

Answer:

About twenty years ago Jobs and Wozniak, the founders of Apple, came up with the very strange idea of selling information processing machines for use in the home. The business took off, and its founders made a lot of money and received the credit they deserved for being daring visionaries. But around the same time, Bill Gates and Paul Allen came up with an idea even stranger and more fantastical: selling computer operating systems. This was much weirder than the idea of Jobs and Wozniak. A computer at least had some sort of physical reality to it. It came in a box, you could open it up and plug it in and watch lights blink. An operating system had no tangible incarnation at all. It arrived on a disk, of course, but the disk was, in effect, nothing more than the box that the OS came in. The product itself was a very long string of ones and zeroes that, when properly installed and coddled, gave you the ability to manipulate other very long strings of ones and zeroes. Even those few who actually understood what a computer operating system was were apt to think of it as a fantastically arcane engineering prodigy, like a breeder reactor or a U-2 spy plane, and not something that could ever be (in the parlance of high-tech) "productized."

The program which handles the interface is called a command-line interpreter or command-line processor. Operating systems implement a command-line interface in a shell for interactive access to operating system functions or services. Such access was primarily provided to users by computer terminals starting in the mid-1960s, and continued to be used throughout the 1970s and 1980s on VAX/VMS, Unix systems and personal computer systems including DOS, CP/M and Apple DOS.

Graphics consisting of text, that can be shaped and stretched in a variety of ways, are called
a.WordArt
b.SmartArt
c.Text Boxes
d. Clip Art​

Answers

Answer:

Word Art

Explanation:

Given your answer choices Word Art is the only one consisting of text that can be shaped and stretched in a variety of ways.

Which type of chart would best display data on the flavors of ice cream that customers prefer?

Answers

Answer: pie chart

Explanation: cause i said so

Pie chart is a type of chart would best display data on the flavors of ice cream that customers prefer.

What do you mean by Pie chart?

A circular statistical visual with slices illustrating numerical proportion is called a pie chart. Each slice's arc length in a pie chart corresponds to the quantity it represents.

Although it was given that name because it resembles a slice of pie, there are other ways to serve it. The Statistical Breviary by William Playfair, published in 1801, is largely credited with creating the first known pie chart.

In the business sector and in the media, pie charts are used a lot. They have been criticized, though, and many experts advise against using them since it can be challenging to compare data from one pie chart to another or between numerous pie charts, according to study.

Learn more about Pie chart, here

https://brainly.com/question/9979761

#SPJ6

Write Java code to display a dialog box that asks the user to enter his or her desired annual income. Store the input in a double variable and display it in a message dialog box. public class AnnualIncome { public static void main(String[] args) { // Write your Java code here } }

Answers

Answer:

Follows are the code to the given question:

import java.util.*;//import package for user-input

public class AnnualIncome // defining a class AnnualIncome

{

public static void main(String[] as)//defining main method

{

double income;//defining double variable

Scanner obx=new Scanner(System.in);//creating Scanner class for user-input

System.out.print("Please enter your desired annual income: ");//print message

income=obx.nextDouble();//input double value

System.out.println("Your income "+income);//print value

}

}

Output:

Please enter your desired annual income: 98659.89

Your income 98659.89

Explanation:

In this code, a class "AnnualIncome" is declared, and inside the main method, the double variable "income" is defined, that uses the scanner class concept for input the value from the user-end, and in the next step, it uses the print method for asked user to enter  value and it uses the print method, that prints income value with the given message.

Other Questions
When the chemical name of a compound is being written, the subscripts will determine the symbols. elements. prefixes. suffixes.When the chemical name of a compound is being written, the subscripts will determine the symbols. elements. prefixes. suffixes. How does a mechanical wave affect the matter in which it travels through?AIt changes its position foreverBIt moves perpendicular to the direction of the wave.CIt has not affect on itDIt may displace it temporarily, however when the wave passes the matter returns backto its original position. simplify the following expression by combining like terms. select the most simplified expression; 2 W + 5 W - 6 + 4w Functions math please help If 2 pounds of grapes cost 6 dollars. How many ponds does 1 dollar get? what is 4 devided by 3/4 Please help! I will give brainliest! 5th grade math. Correct answer will be marked brainliest. hey yall what is this 345 x 345 + 687 Which theme is found throughout the interview with Florence Griffith-Joyner ?A. Belief in oneself creates success.B. Life is a long, difficult journey.C. Appearances can be deceiving.D. Growing up means changing. An expert is someone who Which of the points shown below are on the line given by the equation y = 4x?Check all that appply. Why are Jacks "friends" not really talking to him anymore? Please help me confirm my answer, I got C If a strand of DNA has 20% C, calculate the percentages ofG:T:A On a hot day, a soccer team drank anentire 50 gallon cooler of water, and thendrank half as much again.How much water did they drink?Ill give u brainliest if u show how you got the answer :D Find the rate of change from 2002 to 2008. What kind of sequence is this? 164, 149, 134, 119 What was W.E.B. DuBois's approach to civil rights? 20 points and brainliest! Please help if you know spanish