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
Aleksandr [31]
4 years ago
10

Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicatin

g the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers.
Computers and Technology
1 answer:
Artemon [7]4 years ago
8 0

Answer:

The program to this question can be described as follows:

Program:

#include<stdio.h> //defining header file

int main() //defining main method

{

const int total_number= 20; //defining integer constant variable

int a[total_number],i; //defining integer array and variable  

printf("Enter total number, that you want to insert in list: "); //message  

scanf("%d",&a[0]); //input value by user

printf("Input list: "); //message

for(i=1;i<=a[0];i++) // loop for input value

{

scanf("%d",&a[i]); //input value by user

}

printf("List in reverse order:\n");

for(i=a[0];i>0;i--) //loop for print list in reverse order

{

printf("%d ",a[i]); //print value

}

return 0;

}

Output:

Enter total number, that you want to insert in list: 5

Input list: 6

4

2

8

1

List in reverse order:

1 8 2 4 6  

Explanation:

In the above C language program, three integer variable "total_number, a[], and i " is declared, in which total_number is a constant variable, that holds value 20, which is passed in an array, in array first element we input the total number of the list.

  • In the next step, an array variable is used, that uses for loop to input number in list.  
  • Then another for loop is declared that prints the array value in its reverse order, with a white space.
You might be interested in
The production team for a fictional drama is shooting a key scene. One of the actors leaves out part of his scripted dialogue th
denis-greek [22]

Answer:

at last sentence was . The editor's work .

8 0
3 years ago
Read 2 more answers
Which is a characteristic of vector images? A. They have a large file size and occupy a lot of space. B. They can be resized wit
Naddik [55]

B (They can be resized without losing image clarity)

4 0
3 years ago
__________ are the first line of defense against unsafe drivers.
vova2212 [387]
Peace officers are the first line of defense against unsafe drivers. These officers are appointed for a specific purpose of upholding law and order, so they would be the ones who are there to help you in case of an accident caused by unsafe drivers. A peace officers is just another term for a law enforcement officer, or just the police.
5 0
3 years ago
What should not be compromised when trying to meet standards and deadlines?
n200080 [17]
A i believe is the answer
5 0
4 years ago
Dairy Farm decided to ship milk in containers in the form of cubes rather than cylinders. Write a program called ws4.cpp that pr
Sonja [21]

Answer:

1. #include <iostream>

2. #include <cmath>

3.  

4. using namespace std;

5.  

6. int main()

7. {

8.     float radius;  

9.     cout << "Type the radius of the base: "; // Type a number

10.     cin >> radius ; // Get user input from the keyboard

11.      

12.     float height;  

13.     cout << "Type the height: "; // Type a number and press enter

14.     cin >> height; // Get user input from the keyboard

15.      

16.     float volumeCylinder = 3.1416 * radius * radius * height;

17.     float cubeSide = std::pow(volumeCylinder, 1/3.);

18.     cout<<"Cube side is: "<< cubeSide;

19.      

20.     return cubeSide;

21. }

Explanation:

  • From line 1 to 5 we include two libraries
  • From line 6 to 7 we declare our main function
  • From line 8 to 11 we ask the user for the radius of the cylinder
  • From line 12 to 15 we ask the user for the height of the cylinder
  • On line 16 we calculate the volume of the cylinder using the formula        V=pi*(r^2)*h
  • On line 17 we calculate the side of the cube with the same volume as the cylindrical container using the formula side=∛(V)
  • From line 18 to 21 we print and return the value of the cube's side  
Download cpp
3 0
3 years ago
Other questions:
  • Tanya has received an email, apparently from her bank, stating that some of her records were lost during server maintenance work
    13·2 answers
  • Heelo how do u do python syntax lesson 11 on code academy
    12·1 answer
  • Which of the following are documents that can help you to review and assess your organization’s status and state of security? Fi
    6·1 answer
  • What is the most efficient way to prevent the spelling checker from repeatedly flagging a correctly spelled name in all of your
    5·1 answer
  • ¿Cuánta energía consumirá una lavadora de 1200W de potencia, si se deja conectada durante 20 horas? ¿Cuánto deberemos pagar si e
    7·1 answer
  • Plsss help me plsssssss
    11·1 answer
  • What method do phishing and spoofing scammers use
    12·1 answer
  • Which mechanical switches are the loudest and clickiest?
    15·1 answer
  • Which computer can perform the single dedicated task? a. Which commuter can perform the function of both analog and digital devi
    6·1 answer
  • Im drinking coffee. and working on school and watching a show. Whos with me?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!