An algorithm to print a set of 10 integers in ascending order

Answers

Answer 1

Answer:

Program  - Array Sorting

Author   - Vishal Solanki

Language - C Language

Date     - 03/02/2018 (dd/mm/yyyy)

*/

//IDE used for this code is "Visual Studio 2017"

#include <stdio.h>              //including stdio.h for printf and other functions

#include<conio.h>

int main()                        //default function for call

{

int a[100],n,i,j;

printf("Array size: ");

       scanf("%d",&n);

       printf("Elements: ");

       

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

   {

       scanf("%d",&a[i]);

   }

for (int i = 0; i < n; i++)                     //Loop for ascending ordering

{

 for (int j = 0; j < n; j++)             //Loop for comparing other values

 {

  if (a[j] > a[i])                //Comparing other array elements

  {

   int tmp = a[i];         //Using temporary variable for storing last value

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

   a[j] = tmp;             //storing last value

  }  

 }

}

printf("\n\nAscending : ");                     //Printing message

for (int i = 0; i < n; i++)                     //Loop for printing array data after sorting

{

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

}

for (int i = 0; i < n; i++)                     //Loop for descending ordering

{

 for (int j = 0; j < n; j++)             //Loop for comparing other values

 {

  if (a[j] < a[i])                //Comparing other array elements

  {

   int tmp = a[i];         //Using temporary variable for storing last value

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

   a[j] = tmp;             //storing last value

  }

 }

}

printf("\n\nDescending : ");                    //Printing message

for (int i = 0; i < n; i++)                     //Loop for printing array data after sorting

{

 printf(" %d ", a[i]);                   //Printing data

}

return 0;          //returning 0 status to system

getch();

}

//Ouput

/*

Array size: 10

Elements :  3  4  7  6  5  1  2  8  10  9

Ascending :  1  2  3  4  5  6  7  8  9  10

Descending :  10  9  8  7  6  5  4  3  2  1

*/

Explanation:


Related Questions

PLEASE HELP ME WITH THIS i will mark you brainlist

Answers

Answer: you have to check your email and click on the microsoft email they sent you and enter the code in the email.

Explanation: plz mark brainliest

It's common to print a rotating, increasing list of single-digit numbers at the start of a program's output as a visual guide to number the columns of the output to follow. With this in mind, write nested for loops to produce the following output, with each line 60 characters wide: | | | | | | 123456789012345678901234567890123456789012345678901234567890

Answers

Answer:

The program in python is as follows:

for i in range(0,6):

   for i in range(0,9):

       print(" ",end='')

   print("|",end='')

print()

for i in range(1,61):

   print(i%10,end='')

Explanation:

See attachment for program output format

The next two instructions create a nested for loop

for i in range(0,6):

   for i in range(0,9):

This prints 9 spaces

       print(" ",end='')

This prints a vertical line at the top of the end of the spaces printed

   print("|",end='')

This prints a new line

print()

This iterates from 1 to 60

for i in range(1,61):

This prints 1, 2, 3....9, then 0, 6 times on a straight line

   print(i%10,end='')

Where are the kidneys located?
a) Attached to the bladder
b) Lower back
c) Upper back
d) Middle back
e) Chest cavity
f the following is acian of health

Answers

Answer:

B

Explanation:

Your kidneys are fist-sized organs shaped like beans that are located at the back of the middle of your trunk, in the area called your flank. They are under the lower part of your ribcage on the right and left sides of your backbone.

Pls awnser I will mark brainliest math

Answers

It’s 34....!!!! i did this before

Answer:

2788 or 116

Explanation:

of what is famous Ted Nelson?​

Answers

Answer:

Nelson proposed a system where copying and linking any text excerpt, image or form was possible.

Explanation:

Ted Nelson is one of the theoretical pioneers of the world wide web who is best known for inventing the concept of hypertext and hypermedia in the 1960s. As one of the early theorists on how a networked world would work.

How I know:

I goggle it.

You are the systems administrator for a large trust company. Most of the Linux servers in the company host databases that are accessed frequently by company employees. One particular Linux server has been reported as being very slow today. Upon further investigation using the top utility, you have found a rogue process that is wasting a great deal of system resources. Unfortunately, the rogue process is a database maintenance program and should be killed with caution. Which kill signal would you send this process and why? If the rogue process traps this signal, which other kill signals would you try? Which command could you use as a last resort to kill the rogue process?​

Answers

Answer:

soo long this one is ufff

Write a Java program that asks the user to enter an array of integers in the main method. The program should prompt the user for the number of elements in the array and then the elements of the array. The program should then call a method named minGap that accepts the array entered by the user as a parameter and returns the minimum 'gap' between adjacent values in the array. The main method should then print the value returned by the method. The gap

Answers

Answer:

In Java:

import java.util.*;

class Main {  

public static void minGap(int intArray[], int arrlength) {  

 if(arrlength <2){return;}

 int minm = Math.abs(intArray[1] - intArray[0]);  

 for (int i = 2; i < arrlength; i++)  

  minm = Math.min(minm, Math.abs(intArray[i] - intArray[i - 1]));  

 System.out.print("Minimum Gap = " + minm);  

}  

public static void main(String arg[]) {  

 Scanner input = new Scanner(System.in);

 int arrlength;

 System.out.print("Array Length: ");

 arrlength = input.nextInt();

 int[] intArray = new int[arrlength];

 for(int i = 0;i<arrlength;i++){

     intArray[i] = input.nextInt();

 }

 minGap(intArray, arrlength);  

} }

Explanation:

The minGap method begins here

public static void minGap(int intArray[], int arrlength) {

This checks if array length is 1 or 0. If yes, the program returns nothing

 if(arrlength <2){return;}

If otherwise, this initializes the minimum gap to the difference between the 0 and 1 indexed array elements

 int minm = Math.abs(intArray[1] - intArray[0]);  

This iterates through the array elements

 for (int i = 2; i < arrlength; i++)  

This checks for the minimum gap

  minm = Math.min(minm, Math.abs(intArray[i] - intArray[i - 1]));  

At the end of the iteration, the minimum gap is printed

 System.out.print("Minimum Gap = " + minm);  

}  

The main method begins here

public static void main(String arg[]) {  

 Scanner input = new Scanner(System.in);

This declares the length of the array

 int arrlength;

This prompts the user for array length

 System.out.print("Array Length: ");

This gets the user input

 arrlength = input.nextInt();

This declares the array

 int[] intArray = new int[arrlength];

The following iteration gets input for the array

 for(int i = 0;i<arrlength;i++){

     intArray[i] = input.nextInt();

 }

This calls the minGap method  

minGap(intArray, arrlength);  

}

Write a C console application that will be used to determine if rectangular packages can fit inside one of a set of spheres. Your program will prompt the user for the three dimensions that define a rectangular box; the length, the width, and the height. The interior diameter of a sphere is used to identify its size. Spheres are available in the following five sizes: 4- inch, 6-inch, 8-inch, 10-inch, and 12-inch. Your program will execute repeatedly until the user enters a value of zero for one or more of the rectangular box dimensions. After obtaining the dimensions of the rectangular box, your program will call a function named getSphereSize that determines if the box will fit inside one of the five spheres. The formula for calculating the diagonal of a rectangular box is:

Answers

Answer:

#include <cmath>

#include <iostream>

using namespace std;

int getSphereSize(double length, double breadth, double height) {

   double diagonal = sqrt(length * length + breadth * breadth + height * height);

   if (diagonal <= 4)

       return 4;

   if (diagonal <= 6)

       return 6;

   if (diagonal <= 8)

       return 8;

   if (diagonal <= 10)

       return 10;

   if (diagonal <= 12)

       return 12;

   return 0;

}

int main() {

   double length, breadth, height;

   int sphereCounts[5] = {0};

   int sphereSize;

   while (true) {

       // Get dimensions of the box

       cout << "Enter the dimensions of the box:\n";

       cout << "Length: ";

       cin >> length;

       cout << "Breadth: ";

       cin >> breadth;

       cout << "Height: ";

       cin >> height;

       if (length <= 0 || breadth <= 0 || height <= 0)

           break;

       sphereSize = getSphereSize(length, breadth, height);

       if (sphereSize == 0)

           cout << "The box cannot fit in any of the spheres";

       else

           cout << "The box can fit in the " << sphereSize << "-inch sphere";

       // Increment the counter

       if (sphereSize == 4)

           sphereCounts[0]++;

       else if (sphereSize == 6)

           sphereCounts[1]++;

       else if (sphereSize == 8)

           sphereCounts[2]++;

       else if (sphereSize == 10)

           sphereCounts[3]++;

       else if (sphereSize == 12)

           sphereCounts[4]++;

       cout << "\n\n";

   }

   cout << "\nNumber of 4-inch spheres: " << sphereCounts[0];

   cout << "\nNumber of 6-inch spheres: " << sphereCounts[1];

   cout << "\nNumber of 8-inch spheres: " << sphereCounts[2];

   cout << "\nNumber of 10-inch spheres: " << sphereCounts[3];

   cout << "\nNumber of 12-inch spheres: " << sphereCounts[4];

   cout << endl;

   return 0;

}

Explanation:

The "cmath" library is included in the c++ program. The getSphereSize function is used to return the sphere size the rectangle dimension can fit into. It program continuously prompts the user for the length, breadth, and height of the rectangle and passes the values to the getSphereSize function in the while but breaks if any or all of the variable value is zero.

The sizes of the sphere objects in inches are collected in an array of five integer values of zeros and are incremented by one for every match with a rectangle.

Question # 2
Dropdown
Identify the type of error described.

___5 / 0


___ float('two')

Answers

Answer:

ZeroDivisionError

ValuError

Explanation: Edg 2020-2021

Answer:

1.ZeroDivisionError

2.ValueError

Explanation:

took test

Please help ASAP! will mark brianliest! 30 points!
Which popular VPN protocol allows segment access for users?

IPsec
PPTP
L2TP
SSL VPN

Answers

Answer:

SSL VPN

Explanation:

Secure Sockets Layer, or SSL VPN, is the second common VPN protocol.

A big plus for SSL VPNs is that they can allow segmented access for users. For example, users can be limited to checking email and accessing shared drives rather than having access to the entire network.

SSL VPNs come in two types, SSL portal and SSL tunnel.

SSL Portal VPNs

SSL Portal VPNs allow a user to securely access the web from a browser once the user logs into the VPN’s online portal using a specified method of authorization.

This type of SSL VPN gets its name because of how the user accesses it – through a single web page, or portal. The page acts as a single gateway to the other services available on the secured network.

SSL Tunnel VPNs

SSL Tunnel VPNs allow the user to not only access the web securely, but to also use applications and other network services that aren’t based on the web.

Due to their sophisticated segmentation capabilities, SSL VPNs often require more skill to implement.

VPNs are not a cure-all

Of course, what you could do is circumvent the entire debate around VPN SSL vs IPSEC. Our Gatekeeper offering is an enhanced alternative to VPN with no client, that still offers two-factor authentication to secure remote access.

Wherever you land between VPN SSL vs IPSEC, of if you join #TeamGatekeeper, having one of these tools to protect web traffic is a great way to help secure information, but it’s not an end-all be-all security solution.

After all, a VPN won’t protect your employees from social engineering attacks such as email phishing.

(hope this helps can i plz brainlist it will make my day :D hehe)

Suppose end system A wants to send a large file to end system B. At a very high level, describe how end system A creates packets from the file. When one of these packets arrives to a packet switch, what information in the packet does the switch use to determine the link onto which the packet is forwarded

Answers

Answer:

The answer is below

Explanation:

Suppose end system A wants to send a large file to end system B, the large file is first divided into smaller chunks. Each chunk is then assigned a header forming a packet. Multiple packets are being generated with each of the packet containing a unique destination address in its header.

When a packet arrives at the packet switch, the switch uses the unique destination address that is attached in the header of the packet to determine the link onto which the packet is to be forwarded.

What is the final gear reduction of a compound gear reduction of 36 to 12 for the first stage and 60 to 12 for the second stage?
A. 0.067
B. 0.533
C. 8
D. 15

Answers

Answer:

8

Explanation:

Gear reduction = driven gear teeth / driving gear teeth

First stage reduction :

Driven gear teeth = 36

Driving gear teeth = 12

36 /12 = 3

Second stage reduction :

Driven gear teeth = 60

Driving gear teeth = 12

60 /12 = 5

First stage + second stage

3 + 5 = 8

Which of the following are advantages of converting analog audio to digital audio? Choose all that apply

Reduction in editing time

Consistently accurate copies of audio recordings

Preservation

Susceptibility to computer viruses

Answers

Answer:

b and c

Explanation:

sorry if there wrong

Answer: A, B, and C

Explanation:

Implement the ArrayMethod application containing an array that stores eight integers. The application should call the following five methods: 1. display - should display all the integers 2. displayReverse - should display all the integers in reverse order 3. displaySum - should display the sum of the integers 4. displayLessThan - should display all values less than a limiting argument 5. displayHigherThanAverage - should display all values that are higher than the calculated average value.

Answers

Answer:

public static void display(int [] arr){

   System.out.print("Arrays: ");

       for(int i =0;i<arr.length;i++){

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static void displayReverse (int [] arr){

   System.out.print("Arrays in reverse order: ");

       for(int i=arr.length-1;i>=0;i--){

           System.out.print(arr[i]+" ");

       }

       System.out.println();

   }

   

public static int displaySum (int [] arr){

   System.out.print("Sum: ");

   int sum = 0;

       for(int i =0;i<arr.length;i++){

           sum+=arr[i];

       }

       return sum;

   }

   

public static void displayLessThan (int [] arr, int num){

       System.out.print("Less than "+num+": ");

       for(int i =0;i<arr.length;i++){

           if(arr[i]<num){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

public static void displayHigherThanAverage  (int [] arr){

       System.out.print("Higher than average: ");

       int sum = 0;

       for(int i =0;i<arr.length;i++){

           sum+=arr[i];

       }

       float average = sum/arr.length;

       for(int i =0;i<arr.length;i++){

           if(arr[i]>average){

               System.out.print(arr[i]+" ");

           }

       }

       System.out.println();

   }

Explanation:

The methods were written in Java. See attachment for explanation where I used comments to explain each lines.

Note that lines that begin with double slash (//) are comments

Select the correct answer.
A computer using a connectionless network protocol sends too many data packets to another computer, causing loss of a few packets. As a result, the message appears jumbled to the user at the destination computer. How does TCP overcome this issue?
A.
by using flow control
B.
by using cables
C.
by using terminals
D.
by using a larger IP address
Please only answer if you are 100% sure

Answers

Answer:

D by using a larger IP address correct

Explanation:

Correct answer I hope this helps you :)

If we use 6 bits for representing positive and negative numbers using 2's
complement methods, what is the value of 11100?

Answers

Answer:

-4


Explanation:
In binary, 11100 is 28
But in the two’s complement method, it will equals = (-4).
the last number always represents negative number.
In other words, if this (101010) with 6 digits. Without using two’s complement method, it would be 42 in binary. But with two’s complement method, it would ( - 22)


I hope this helps. Please don’t hesitate to ask if u concerning my answer
Yeeeeeeeeeeeeeeeeeeeeeeee

The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a selected destination. This is basically what is implemented by the traceroute tool. In this task, we will write our own tool. The idea is quite straightforward: just send an packet (any type) to the destination, with its Time-To-Live (TTL) field set to 1 first. This packet will be dropped by the first router, which will send us an ICMP error message, telling us that the time-to-live has exceeded. That is how we get the IP address of the first router. We then increase our TTL field to 2, send out another packet, and get the IP address of the second router. We will repeat this procedure until our packet finally reach the destination. It should be noted that this experiment only gets an estimated result, because in theory, not all these packets take the same route (but in practice, they may within a short period of time). The code in the following shows one round in the procedure. a = IP() a.dst = ’1.2.3.4’ a.ttl = 3 b = ICMP() send(a/b) If you are an experienced Python programmer, you can write your tool to perform the entire procedure automatically. If you are new to Python programming, you can do it by manually changing the TTL field in each round, and record the IP address based on your observation from Wireshark. Either way is acceptable, as long as you get the result.

Answers

Answer:

answer b

is correct

What are some ways you can work with templates? Check all that apply.
A. creating a new template from scratch
B. scanning a template from a printed page
C. using many different templates in one document
D. using a preexisting template
E. modifying a preexisting template

Answers

What are some ways you can work with templates? Check all that apply.

Answer: (A,D,E) see picture below for help also.

Answer:

Look at the other answer that guy knows what he is talking about

Explanation:

Use three or more sentences to explain to someone why they might need to use a virtual machine.

Answers

Answer:

Benefits of Virtualization

Reduced capital and operating costs.

Minimized or eliminated downtime.

Increased IT productivity, efficiency, agility and responsiveness.

Faster provisioning of applications and resources.

Greater business continuity and disaster recovery.

Simplified data center management.

A line graph is a great tool for showing changes over time. Why is a line graph better than other graphs at showing this type of data?

Answers

Answer:

Line graphs allow us to see overall trends such as an increase or decrease in data over time. Bar graphs are used to compare facts.

Select the correct answer.

Which of these is an adventure game?

A.
Duck Hunt
B.
Tetris
C.
Myst
D.
Sudoku

Answers

Answer: C. Myst because it is an adventure game
The answer is c: myst because it’s an adventure game.

What is the correct order for writing the 3 dimensions for a 3D object? Here are the 3 dimensions:


Width


Height


Length


They need to be written in this format: ___________X___________X___________


Fill in the blanks.
for my sibling.

Answers

Answer:

Length x Width x Hight

Explanation:

What are the challenges of giving peer feedback in peer assessment

Answers

Feeling of underachievement

Answer:

There can some challenges when giving and receiving peer feedback in a peer assessment. Some people can be harsh in their assessments of your work. Some students cannot take that and because of that it can cause them to question a lot of their work. People can also be wrong when it comes to the assessment

Match the data type to the given data.
1. float
2. array
3. Boolean
4. character

false
с
c, o, m, p, u, t, er
26.2

Answers

Float: 26.2
Array: c, o, m, p, u, t, er
Boolean: false
Character: c

Is the current month 12?

Answers

No it currently month 2 February have a nice day:)

The following code will not display the results expected by the programmer. Can you find the error? Declare Real lowest, highest, average Display "Enter the lowest score." Input lowest Display "Enter the highest score." Input highest Set average = low + high / 2 Display "The average is ", average, "."

Answers

Based on the information given, the first error in the code is that the Variable name is lowest, NOT low, and Set average = low + high / 2.

How to find the error in the code.

For Error 2: Variable name is highest, NOT high and Set average = low + high / 2

For Error 3 : Set average = low + high / 2. Thus, you will need to add the lowest and highest, then perform the division by 2

Set average = (lowest + highest) / 2 is the the correct statement.

Learn more about codes on:

https://brainly.com/question/25875879

Other Questions
7 8 + 100 10 what is the sum?? TROUBLE IN TEXASThe Lone Star Republic (1836-1845)Relations with Native AmericansMany problems plagued the Republic of Texas. As more and more people settled in Texas, the Cherokees, Comanches, and other Native American groups resented the newcomers. The ________ ________________ attempted to control unrest on the frontier, but tensions continued. After Lamar became ________________ of the Republic, he ordered the removal of the Cherokees from Texas. On July 16, 1839, the Texas army attacked the Cherokees near the Neches River. Nearly 100 Cherokees were killed including their leader, Chief Bowles. The army _______________ Cherokee villages and farms. The surviving Cherokees were forced from their land and moved across the _______ River, out of Texas. Nora: Tell me, is it really true that you did not love your husband? Why did you marry him?Mrs. Linde: My mother was alive then, and was bedridden and helpless, and I had to provide for my two younger brothers; so I did not think I was justified in refusing his offer.Nora: No, perhaps you were quite right. He was rich at that time, then?Mrs. Linde: I believe he was quite well off. But his business was a precarious one; and, when he died, it all went to pieces and there was nothing left. A Dolls House,Henrik IbsenHow does the character of Mrs. Linde help develop the idea of gender inequality?She says that she married her husband to save his business from failing.She says that she did not think she could turn down her husbands proposal.She says that she married her husband because he was sick and needed care.She says that she married her husband out of love, which was not always done at that time. Use foil method to find (w+5)(w^2+3w) What is the present value of an investment that will be worth $6000 at the end of five years? Assume an APR of 6% compounded monthly. (Round your answers to the nearest cent.) PLEASE HELP !! A 10 ohm resistor is connected to a 9V battery how much current is flowing through the circuit? What can you say about the function that generated the following table of values? O A. the function has no x-intercepts O B. the function has more than one x-intercept C. not enough information to answer the question O D. the function has exactly one x-intercept PLSSS HELP ME1) Which of these bonds is most easily broken?1. All are equally easy to break2. Hydrogen Bond3. Ionic Bond4. Covalent Bond2)Hydrogen bonds are formed due to ______.1. Electromagnetic attraction2. Sharing of electrons3. Stealing of electrons4. 'Stickiness' due to protons and neutrons3) What is a polar molecule?1. A molecule found either at the north or south pole2. A molecule with a positively charged end and a negatively charged end3. A molecule with a distinct beginning and end4. Any molecule that includes oxygen4)Water tension is an example of ______.1.Oxygen bonding2.Hydrogen bonding3.Isometric bonding4. Covalent bonding I need assistance please A student performed an experiment by placing the de shelled egg in a concentrated salt solution for 5 minutes.What changes did he observe in the egg?Name the process What is the "slash and burn" style of agriculture and what are the effects of it? Find the length of side a. Can someone just help me! Which property is being demonstrated? 7. 7 =7+= 7 HI. I really Need help. I will Mark Brainliest! How did Hershey and Chase use radioactivity to draw a conclusion about proteins and DNA? Read this excerpt from "A Student's Guide to GlobalClimate Change."Climate change could make it too hot to grow certaincrops, and droughts caused by climate change couldreduce the amount of water available for irrigation.Climate change is also likely to cause stronger stormsand more floods, which can damage crops. Highertemperatures and changing rainfall patterns could helpsome kinds of weeds and pests to spread to new areas.If the global temperature rises an additional 3.6F, UScorn production is expected to decrease by 10 to 30percent.What evidence does the author include to show thatclimate change is a problem?O Irrigation should be used to successfully grow cropsO Certain crops could be more difficult to grow.O Corn production may decrease by 10 to 30 percent.O Storms may weaken as climate change occurs. 1. Which situation could be represented by y = 4x + 7?a student started with $4 and saved $7 per week.A package costs $7 plus $4 per pound to ship.A skateboard weighs 4 pounds plus 7 ounces.A recipe calls for 7 cups of flour and 4 cups of sugar.2. What is the equation of the line through (5,8) and (2,2)?y = 2x + 2y = 2x - 2y = 5x - 8y =8x - 53. The slope of a line is -1/3 and the y-intercept is 3. What is the equation of this line?y = 1/3 + 3y = -1/3 + 3y = 3x - 3y = 3x - 1/34. What is the equation of the line that has a slope of 2 and goes through (3,7)?y = 2x + 3y = 1/2x + 7y = 2x + 1y = -2x + 15. Sammy is saving up to buy a PS5 plus. He has $40 and will save $60 per week. Which equation represents this situation?1 pointy = 40x + 60y + 60x + 40y = 60x - 40y = 40x - 606. Sammy is saving up to buy a PS5 plus. He has $40 and will save $40 per week. How long will it take Sammy to save the money if the PS5 plus costs $600?11 weeks12 weeks13 weeks14 weeks7. Steph made $360 working 30 hours last week. Sam made $195 working 15 hours last week. Who made more per hour?StephSam Help me please!!!!!!! How can you find the town with a temperature that is the opposite of -4C? Name the town with that temperature