subject

Write a program which prompts the user to enter up to 20 floating point numbers (terminated with a non-numeric), reads them into an array, then prints the following. To make it easier for you, your input is guaranteed to have at least one negative number. Make sure to test with a wide range of values. You must use an array (not a vector) to get credit. The array values in the original order, separated by a space.
The array values where every other element is reversed starting with the first one, separated by a space (see example).
Negative values, separated by a space in the same order as the original array (zero is neither positive nor negative).
The smallest number in the array.
The average of all the negative values in the array.
Example program output with user input shown in bold:

Enter a list of up to 20 integers, and a non-numeric to quit:
-8.9 1.2 -1.1 2.3 3.4 4.5 5.6 6.7 7.8 8.9 -5.0 q

The original array is: -8.9 1.2 -1.1 2.3 3.4 4.5 5.6 6.7 7.8 8.9 -5
The reversed array: -5 1.2 7.8 2.3 5.6 4.5 3.4 6.7 -1.1 8.9 -8.9
Negative values: -8.9 -1.1 -5
Smallest number: -8.9
Average of all the negative values: -5

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:30
Write a function called checkfactor that takes two arrays of positive numbers, firstnumberrow and secondnumberrow. checkfactor checks if the first entry in firstnumberrow is divisible by the first entry in secondnumberrow, and performs the same operation on the next array elements until all entries have been checked. all the numbers are positive and the number of entries in the arrays are the same. the function should return the identified divisible numbers in two row arrays named firstdivisible and seconddivisible.restrictions: branches or loops should not be used. the code must use the internal mod and logical functions.hint: the mod function should be used to determine if two numbers are divisible. ex: for num1 and num2 if mod(num1,num2) is 0, then the two numbers are divisible.this is matlab
Answers: 2
question
Computers and Technology, 25.06.2019 07:50
Identify an advantage of centralized processing
Answers: 1
question
Computers and Technology, 25.06.2019 08:30
In the context of intentional computer and network threats a is a programming routine built into a system by its designer
Answers: 2
question
Computers and Technology, 25.06.2019 14:00
Which of the following exceptions could occur when the following code is run, if the precondition is met? // precondition: a is not null public string dosomething(arraylist a, int b) { int i; string s; for (i = 0; i < = a.size(); i++) { s = (string)(a.get(i)); if (s.length() == b) { return s; } } return null; }
Answers: 1
You know the right answer?
Write a program which prompts the user to enter up to 20 floating point numbers (terminated with a n...
Questions
question
Mathematics, 01.07.2020 18:01
question
Mathematics, 01.07.2020 18:01
question
History, 01.07.2020 18:01
question
Mathematics, 01.07.2020 18:01
Questions on the website: 13722360