answersLogoWhite

0


Best Answer
  1. Declare the array
  2. use a for loop going from 0 to 4
  3. within that loop, ask a question, and store it in the array at the current index
  4. start another for loop going from 4 to zero
  5. in that loop output the questions.

For instance, if you're doing it in C, it would be something like this:

#include

int main(int argc, char *argv[]){

int answer[5], n;

for(n = 0; n < 5; n++){

printf("Gimme a number: ");

scanf("%i", &answer[n]);

}

for(n = 4; n >= 0; n--){

printf("%i\n", answer[n]);

}

return 0;

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you input 5 numbers and out put the sum and print these numbers in the inverted order using array structure?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


Write a C function to remove duplicates from an ordered array for example if input is 11134458810 then output should be 1345810?

Assuming that the input has already been put into an int[] array, the function to remove duplicates will operate as follows. The function will create an output array that will accept each first unique int of the input array. A comparator will compare each following cell, ignoring duplicates until the end of the array is reached. The output array will then be printed.


How do you write a program that accepts 50 integer values and sort them in basic programming?

Create an array with 50 elements and input the integers one a time, filling the array. Use an insertion sort on the array for each input except the first. Alternatively, input the values first and then use insertion sort.


How do you write a c plus plus program that will average 10 numbers entered and print the array?

#include&lt;iostream&gt; #include&lt;sstream&gt; #include&lt;vector&gt; using namespace std; int main() { vector&lt;int&gt; Array; for (size_t index=0; index&lt;9; ++index) { int i; bool valid = false; while (!valid) { cout &lt;&lt; "Enter a number: "; string input; cin &gt;&gt; input; stringstream ss; ss &lt;&lt; input; valid = (ss &gt;&gt; i); if (!valid) cout &lt;&lt; "Invalid input.\n"; } Array.push_back (i); } // print array and average int average=0; for (size_t index=0; index&lt;9; ++index) { cout &lt;&lt; Array[index] &lt;&lt; ' '; average += Array[index]; } average /= 10; cout &lt;&lt; "\nAverage: " &lt;&lt; average &lt;&lt; endl; }


What is the boolean expression for a NAND gate?

There are two forms of the NAND gate. Inverted input: Ouput = not Input1 and not Input2 and not Input3 ... Inverted output: Output = not (Input1 and Input2 and Input3 ...)


How can you search an array element in a file?

Logic to search element in array Input size and elements in array from user. ... Input number to search from user in some variable say toSearch . Define a flag variable as found = 0 . ... Run loop from 0 to size . ... Inside loop check if current array element is equal to searched number or not. To learn more about data science please visit- Learnbay.co


What is invertion?

An inverting amplifier is one where the output is an inverted function of the input. The Class A transistor amplifier, also known as common-emitter, is inverting. As you increase the voltage on the base, the output voltage on the collector decreases. The operational amplifier has an inverting and a non-inverting input. In typical bridge mode, the output is inverted with respect to the (inverting) input, and the non-inverting input is used to reject common-mode input signals by moving the virtual ground point as needed.


What is the input structure of the neuron?

Dendrites.


How do you create a program that will let the user to enter 10 numbers and arrange it in ascending and descending?

#include "stdio.h" #define ARRAY_SIZE 10 void fill(float* array, int size); void spill(float* array, int size, char* delimiter); void bubble_sort(float* array, int size); void reverse(float* array, int size); void swap(float* a, float* b); int main(int argc, char* argv[]) { float numbers[ARRAY_SIZE]; fill(numbers, ARRAY_SIZE); bubble_sort(numbers, ARRAY_SIZE); spill(numbers, ARRAY_SIZE, " "); reverse(numbers, ARRAY_SIZE); spill(numbers, ARRAY_SIZE, " "); return 0; } void fill(float* array, int size) { int i = 0; while (i &lt; size) fscanf(stdin, "%f", array + (i++)); } void spill(float* array, int size, char* delimiter) { int i = 0; while (i &lt; size) fprintf(stdout, "%f%s", array[i++], delimiter); fputc('\n', stdout); } void bubble_sort(float* array, int size) { int i, j; for (i = 0; i &lt; size; i++) for (j = i; j &lt; size; j++) if (array[i] &gt; array[j]) swap(array + i, array + j); } void reverse(float* array, int size) { int i; for (i = size / 2; i &gt;= 0; i--) swap(array + i, array + (size - (i + 1))); } void swap(float* a, float* b) { float c = *a; *a = *b; *b = c; } fill gets the numbers from input spill sends them to output bubble sort will sort the array in ascending order reverse will reverse the list so that it is in descending order swap is used to swap two floats You can change float to double or int depending on which datatype you want to use.


How do you create Write a program that takes 10 integers as input The program will place these integers into an array and display the following 1. List in ascending order 2. mean 3. median 4.max val?

import java.util.Arrays; import java.util.Scanner; public class Answers { public static void main(String[] args) { //Creates a scanner object named console. Scanner console = new Scanner(System.in); //Variabels int [] numbers = new int [10]; double avg = 0.0; double median = 0.0; int max = numbers[0]; double count = 0.0; //User input. for (int i = 0; i &lt; numbers.length; i++){ System.out.print("Number: "); numbers[i] = console.nextInt(); } //break System.out.println("==============="); //finds the average and max value. for (int i = 0; i &lt; numbers.length; i++){ count += numbers[i]; avg = count / numbers.length; //average if (numbers[i] &gt; max){ //finds the max value. max = numbers[i]; } } median = (numbers[4] + numbers[5])/2; //Median value //Display to user. System.out.println("Highest value found: " + max); //Show maximum value found in array System.out.printf("Median is: %.3f \n",median); //Show median System.out.printf("Average is: %.3f \n",avg); //Show average sortAsc(numbers); //Print out whole array ascending } //Method for sorting an Array ascending. public static void sortAsc(int [] array){ for (int i = 0; i &lt; array.length; i++){ Arrays.sort(array); System.out.println(array[i]); } } } This should do everything you asked for, hope this helps!


Why output voltage in common base amplifier is in phase to input voltage?

The output of a common emitter stage is inverted, it is not out of phase.


How do you make an input program that computer can determine the highest number?

Here it is in Java for 5 numbers: (adapt for your programming language) import java.util.Arrays Public class Highestnumber { public static void main (String args[]) { Scanner input = new Scanner( System.in ); int numberofinputs = 5; //make an array to hold the numbers int numbers[] = new Int[numberofinputs]; for (x=0;x&lt;numberofinputs;x++) { System.out.print("Please input a number: "; numbers[x] = input.nextInt(); } //Sorts Numbers from least to greatest Arrays.sort(numbers[]); //gets highest number int highestnum = numbers[numberofinputs-1] //displays highest number System.out.println("The highest number is:" + highestnum); } }