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
Westkost [7]
3 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 less than 20 integers.
Computers and Technology
1 answer:
kkurt [141]3 years ago
3 0

Answer:

The program to this question as follows:

Program:

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

int main() //main method.

{

const int size= 20; //define variable.

int a[size]; //define array

int i, n; //define variable

printf("Enter number of elements :"); //message.

scanf("%d", &n);//input size of array.

printf("Enter array elements :"); //message

for (i = 0; i < n; ++i) //loop

{

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

}

printf("Reverse order :\n");

for (i = 0; i < n; ++i) //loop

{

printf("%d ",a[n-i-1]); //print elements in reverse order.

}

return 0;

}

Output:

Enter number of elements :5

Enter array elements :5

4

3

2

1

Reverse order :

1 2 3 4 5  

Explanation:

The description of the above program as follows:

  • In the program firstly we include the header file and define a method that is "main method" in the method we define variables that are "size, n, i, and a[]".  The size variable is used to make a variable constant that means its value will not change in the program. We pass the size variable value to the array and use i variable for loop.
  • We use variable n and a[] for user inputs. In n variable, we input a number of elements to be inserted into an array and a[] we insert all array elements to insert these elements we use for loop.
  • Then we define another for loop in this loop we print all array elements in reverse order.
You might be interested in
Click/press _______ to remove the most recently typed text.
bagirrra123 [75]

Answer:

ctrl Z

Explanation:

ctrl Z is the shortcut for undo it will reverse the last thing you did ctrl Y is redo if i accidently did ctrl Z i can do ctrl Y. Hope this helps!

6 0
3 years ago
Between which zones and a DMZ should firewalls be placed? Choose two answers.
brilliants [131]

Answer:

Internal and External Zones

Explanation:

Demilitarized Zone (DMZ) in a network means that, we make sure the security of network at higher level as military make sure the security of their bases or zones.

In this type of network, The network of the internal organization (LAN) needs security from hackers and unauthorized users who are trying to access the resources and information from the network.

This network is divided into two major zones. A DMZ has been placed between two zones along with firewalls enhance the security of LAN Network from the networks on internet. These two zones are named as Internal and External Zone. The firewall between DMZ and External zones monitors the users from external networks on the internet who tries to access organization's network. Internal network monitors the traffic between DMZ and Internal LAN network.

4 0
3 years ago
Nilsu is attempting to train a new administrative assistant on using a word processing program. Since the program is fairly comp
tatiyna

Answer:

teach the assistant bits and pieces of the program.

Explanation:

Given that the program is fairly complex and has many independent components, the most ideal way Nilsu should train a new administrative assistant on using a word processing program is by "teaching the assistant bits and pieces of the program."

This will make the administrative assistant understand and operate the program at a gradual pace without anhthing looking confusing.

5 0
3 years ago
Which shot is not the best for a widescreen image
balu736 [363]
Portrait landscape is better for wide images
6 0
3 years ago
A file named numbers.txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that
Reptile [31]

Answer:

  1. with(open("numbers.txt")) as file:
  2.    data = file.readlines()  
  3.    runsum = 0
  4.    largest = 0
  5.    
  6.    for x in data:
  7.        if(int(x) > largest):
  8.            largest = int(x)
  9.            runsum += largest  
  10.    
  11.    print(runsum)

Explanation:

The solution code is written in Python 3.

Firstly, open a filestream for numbers.txt (Line 1) and then use readlines method to get every row of data from the text files (Line 2).

Create a variable runsum to hold the running sum of number bigger than the maximum value read up to that iteration in a for loop (Line 3).

Use a for loop to traverse through the read data and then check if the current row of integer is bigger than the maximum value up to that point, set the current integer to largest variable and then add the largest to runsum (Line 6 - 9).

At last display the runsum to console terminal (Line 11).

8 0
3 years ago
Other questions:
  • Which of the following is a reliable source of information: a book recommended from my professor, britannica, a blog, or wikiped
    6·1 answer
  • Which of the following binary (base-2) numbers is LARGEST?
    14·1 answer
  • How can you make a circle in JavaScript? Thank you!
    9·1 answer
  • A developer writes a SOQL query to find child records for a specific parent. How many levels can be returned in a single query.
    10·1 answer
  • What is the specifications, number of sales, positive and negative points and a few popular games of the first PlayStation?
    13·1 answer
  • The function below takes two numeric parameters. The first parameter specifies the number of hours a person worked and the secon
    13·1 answer
  • Public class Main{ public static void main(String [] args){ String name=WelcomeJava; Runnable r1=() -&gt; System.out.println(nam
    12·1 answer
  • Algorithm that has been coded into something that can be run by a machine.
    10·1 answer
  • Type the correct answer in the box. Spell all words correctly. Complete the sentence based on the role education plays to help y
    5·1 answer
  • What validation type would you use to check that numbers fell within a certain range? a) range check b)presence check c)check di
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!