answer.
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
jenyasd209 [6]
2 years ago
13

Write a program that gets a list of integers from input, and outputs non-negative integers in ascending order (lowest to highest

). Ex: If the input is: 10 -7 4 39 -6 12 2 the output is: 2 4 10 12 39
Computers and Technology
2 answers:
zhannawk [14.2K]2 years ago
7 0

Answer:

Following are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main()//defining main method

{

   int a[]={10,-7,4,39,-6,12,2};//defining single deminition array and assign value

   int i,x,j,t; //defining integer variable

   cout<<"Before sorting value: ";  

   for(i=0;i<7;i++) //using loop to print value

   {

       cout<<a[i]<<" ";//print value

   }

   cout<<endl <<"After sorting value: ";

   for(i=0;i<7;i++)//defining loop to sort value

{  

 for(j=i+1;j<7;j++)//count array value

 {

  if(a[i]>a[j]) //defining condition to inter change value

  {

      //performing swapping

   t=a[i];  //integer variable t assign array value

   a[i]=a[j];//swapp value

   a[j]=t;//assign value in array

  }

 }

}

for(i=0;i<7;i++) //defining loop to print value

   {

       if(a[i]>=0) //defining condition to check positive value  

       {

       cout<<a[i]<<" ";//print value

       }

   }

   return 0;

}

Output:

Before sorting value: 10 -7 4 39 -6 12 2  

After sorting value: 2 4 10 12 39  

Explanation:

Following are the description to the above code:

  • In the above program code, Inside the main method, an array a[] is declared that assign some value, and another integer variable "i, j, x, and t" is declared, in which variable "i and j" are used in the loop, and "x, t" is used to sort value.
  • In the next step, three main for loop is declared, in which the first loop is used to print array value.
  • In the second loop, inside another loop is used that sorts array values.
  • In the last loop, a condition is defined, that check the positive value in the array and print its values.
yanalaym [24]2 years ago
3 0

Answer:

integers=[]

while True:

      number=int(input())

      if number<0:

       break

      integers.append(number)  

print("",min(integers))

print("",max(integers))

Explanation:

You might be interested in
Which of the following statements are true. .ascii stores string in memory and terminate it with NULL character. There is no way
Tems11 [23]

Answer:

The true statements are:

There is an assembler directive to arrange / place floating point values in static data memory

MARS always uses setting '.set boat'

Explanation:

It is the assembler directive who arranges and places the floating point values for the static data memory. Obviously there is no such way for the MIPS assemble programming for reservation of the static data memory without having any initialization for a considerable value.

MARS would definitely use the setting set “noat” ascii would store the string in the memory and then terminate it with respect to NULL character. They cannot reserve the MIPS assembly programming for a considerable value.

4 0
2 years ago
Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image
Rina8888 [55]

Explanation:

Sampling and RBG (red blue green) pixels and also the binary sequences working together such that it display any digitally colored image by allowing the computer system know where the Red Blue Green pixel is going to be placed and also what the opacity would be for that pixel. The combination of these components is what gives you a digital color image.

5 0
2 years ago
An admission charge for The Little Rep Theater varies according to the age of the person. Develop a solution to print the ticket
Lina20 [59]

Answer:

age = int(input("Enter your age: "))

charge = 0

if age > 55:

   charge = 10

if 21 <= age <= 54:

   charge = 15

if 13 <= age <= 20:

   charge = 10

if 3 <= age <= 12:

   charge = 5

if 0 <= age < 3:

   charge = 0

   

print(charge)

Explanation:

*It is in Python.

Ask the user for the age

Check the each given range and set the charge accordingly using if statements

Print the charge

6 0
2 years ago
After running the following pseudocode, what will the value of VARIABLE be? 1. Set value of VARIABLE to 5 2. Increase the value
Nutka1998 [239]

Answer:

10

Explanation:

you start with 5       5

you add 3                8

the variable is not odd so skip         8

the variable is even so add 1            9

the variable is odd so add 1              10

10

hope this helps <3

8 0
2 years ago
By specifying a(n) ____ specifically for handheld devices, you can customize the page layout such as by designing the content to
antoniya [11.8K]

Answer:

Style sheet.

Explanation:

A website is a collection of web pages. Web development tools are mainly HTML,CSS and JavaScript. They have their individual functions in structuring a web page.

JavaScript is a purpose object oriented programming language widely used in web page for writing scripts, aimed to make web pages interactive.

HTML is a mark-up language which provides a non-linear structuring approach to web page development.

CSS or cascaded style sheet is a tool used to design the element and layout of web pages on a device screen.

7 0
2 years ago
Other questions:
  • Which option describes wearable technology?
    5·2 answers
  • Give at least one example computer application for which a connection-oriented service is appropriate and at least one example c
    12·1 answer
  • The ________ method is based on simple arithmetic. The process involves dividing the bits of a frame into equal segments, adding
    11·1 answer
  • Mel is skilled in identifying the technical, economic, and organizational feasibility of software. In which phase of SDLC should
    13·1 answer
  • The relational model describes data using a standard tabular format; all data elements are placed in three-dimensional tables ca
    5·1 answer
  • Alyosha was explaining to a friend the importance of protecting a cryptographic key from cryptoanalysis. He said that the key sh
    10·1 answer
  • Assume that the population of Mexico is 128 million and that the population increases 1.01 percent annually. Assume that the pop
    7·1 answer
  • Write a program that reads the lengths of the sides of a triangle from the user. Compute the area of the triangle using Heron's
    8·1 answer
  • Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combinin
    11·1 answer
  • Docker is focused on ______ containerization.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!