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
Ymorist [56]
1 year ago
13

write a function print array to print an array on one line as: 9 8 7 6 5 4 3 2 1 0 write and test a function called bubble sort

that implements this sorting method and call it from your main function. you will need to swap elements to sort the array.
Computers and Technology
1 answer:
Lisa [10]1 year ago
4 0

Function print array to print an array on one line as:

void printArray(int arr[], int n)
{
   int i;
   for (i = 0; i < n; i++)
       printf("%d ", arr[i]);
   printf("\n");
}
void bubbleSort(int arr[], int n)
{
  int i, j;
  for (i = 0; i < n-1; i++)      
      for (j = 0; j < n-i-1; j++)  
          if (arr[j] > arr[j+1])
             swap(&arr[j], &arr[j+1]);
}
void main()
{
   int arr[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
   int n = sizeof(arr)/sizeof(arr[0]);
   printf("Given array is \n");
   printArray(arr, n);
   bubbleSort(arr, n);
   printf("\nSorted array is \n");

What is array?
An array is a type of data structure used in computer science that contains a set of elements (values and variables), each of which is designated by an array index or key. The simplest type of data structure is indeed a linear array, also known as a one-dimensional array. For instance, an array of ten 32-bit (4-byte) arithmetic operations, to indices 0 through 9, may be stashed as ten words at memory addresses 2000,2004,2008,..., 2036 (in hexadecimal: 0x7D0, 0x7D4, 0x7D8,..., 0x7F4) so that the element with index

To learn more about array
brainly.com/question/24275089
#SPJ4

You might be interested in
________ employs state-of-the-art computer software and hardware to help people work better together.
qaws [65]

Answer:not enough information

Explanation:

6 0
3 years ago
Which of these is an effective color scheme? A. red text on black background B. red text on red background C. yellow text on bl
Natasha2012 [34]
Effectively, Yellow text on a black background would show up the best.
The contrast of the bright and dark would be the best for people to see.

Hope this helps!

3 0
3 years ago
Read 2 more answers
Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the larges
denpristay [2]

Answer:

The code to this question can be defined as follows:

public double centeredAverage(ArrayList<Integer> nums) //defining a method centeredAverage that accepts an array nums

{

   if ((nums == null) || (nums.size() < 3))//define if block for check simple case value

   {

       return 0.0;//return float value

   }

   double sum = 0; //defining a double variable sum

   int smallest = nums.get(0);//defining integer variable and assign value

   int largest = nums.get(0);//defining integer variable and assign value

   for (int i = 0; i < nums.size(); i++) //defining for loop for stor ith value

   {

       int value = nums.get(i);//defining integer value variable to hold nums value

       sum = sum + value;//use sum variable for add value

       if (value < smallest)//defining if block to check value less then smallest

           smallest = value;//hold value in smallest variable  

       else if (value > largest)//defining else if block that checks value greater them largest value

           largest = value; //hold value in largest variable

   }

   sum = sum - largest - smallest;  // use sum to decrease the sum largest & smallest value

   return (sum / (nums.size() - 2)); //use return keyword for return average value

}

Explanation:

In the question, data is missing, that's why the full question is defined in the attached file please find it.

In the given code a method "centeredAverage" is used that accepts an array in its parameter and inside the method, if block is used that checks the cash value if it is true, it will return a float value.

In the next step, two integers and one double variable is defined, that use the conditional statement for check hold value in its variable and at the last use return keyword for return average value.

3 0
4 years ago
Programming In C:
levacccp [35]

Our function will simply be the inverse of the given one: celsius and kelvin degrees differ by 273.15. You add this number is you compute kelvin from celsius, and you subtract this number if you're going the other way around (which is what we're doing):

#include

double KelvinToCelsius(double valueKelvin ) {

double valueCelsius = 0.0;

valueCelsius = valueKelvin - 273.15;

return valueCelsius ;

}

3 0
3 years ago
What is the fulform of PDA​
jolli1 [7]

Answer:

I don't know sorry, delete if u want

Explanation:

8 0
3 years ago
Other questions:
  • Let K(x, y) denote the statement "x knows y" and D denote the domain of all people. Express the following English sentences as a
    9·1 answer
  • Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. Given a variable modelYear write a statement that prin
    8·1 answer
  • A user calls you and says that when they try to connect to the internal website, they are prompted for authentication. The user
    14·1 answer
  • Which of the following are common data types? Check all that apply.
    6·1 answer
  • Which of the following best describes how to measure the spread of the data? a) The IQR is a better measure of spread for badmin
    5·1 answer
  • 97 points pleaseeee helpppp
    8·2 answers
  • What steps should you take if your harassed online​
    9·2 answers
  • What types of character Microsoft Excel understand​
    6·1 answer
  • And this also please. help​
    15·1 answer
  • WHO WANT P O I N T S.................................................
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!