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
kotykmax [81]
3 years ago
12

write a function issorted() that accepts an array of real numbers arr and an integer n as arguments, where n is the size of arr.

The function properly reads n integers into the array arr,then finds and returns whether the items of the array are sorted in ascending order.
Computers and Technology
1 answer:
lesantik [10]3 years ago
7 0

Answer:

Here is code in java.

import java.util.*;

class Main

{

//main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

       int m;

        // scanner object to read input from user

       Scanner ss=new Scanner(System.in);

       System.out.println(" size  of the array:");

       //read the size of the array

        m=ss.nextInt();

        // create array of the given size

        float arr[]=new float[m];

        /* call function to check whether input are in the ascending sorted order or not */

        Boolean res= issorted(arr,m);

       

      // print the result

       System.out.println("array in the ascending sorted order  : "+res);

     

       

   }catch(Exception ex){

       return;}

}

 // function to check whether input are in the ascending sorted order or not

public static boolean issorted(float[] arr,int n)

{

    int i,j;

    float d;

    Boolean flag=true;

    Scanner ss=new Scanner(System.in);

    System.out.println("enter the elements of the array:");

     // read elements of the array

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

    {

        arr[i]=ss.nextFloat();

    }

   

    // check elements re in the ascending order or not

    for(j=0;j<n-1;j++)

    {

        if(arr[j]>arr[j+1])

        {

            flag=false;

            break;

        }

    }

     // return the result

    return flag;

}

}

Explanation:

With the help of scanner class object, read the size "m" of array.Create an array of  the given size. Pass array and integer into the function issorted(). Read the elements of the array and then check elements are in the ascending order or not.It will return "true" if elements are in the sorted order else it will return "false".

Output:

enter  size  of the array:                                                                                                                                    

5                                                                                                                                                              

enter the elements of the array:                                                                                                                              

1 2 3 4 7                                                                                                                                                      

array in the ascending sorted order  : true                                                                                                                              

enter  size  of the array:                                                  

5                                                                            

enter the elements of the array:                                              

2 4 9 3 5                                                                  

array in the ascending sorted order  : false

You might be interested in
A(n) ________________ is a software tool for specifying the content and format for a database report.
Alex_Xolod [135]
A report generator is a software tool for specifying the content and format for a database report. It is a program where it takes data from a database and use it in producing a file that can be understood by humans. These databases include XML stream, OpenCover, PartCover and the like.
7 0
3 years ago
Memory chips are used in ____ storage devices to read and write data
MakcuM [25]
Solid state storage?
There are three different types,
Like RAM, ROM, SSS

5 0
3 years ago
You are consulting with another medium sized business regarding a new database they want to create. They currently have multiple
kompoz [17]

Answer:

The enormous amount of data and information that a company generates and consumes today can become an organizational and logistical nightmare. Storing data, integrating it and protecting it, so that it can be accessed in a fluid, fast and remote way, is one of the fundamental pillars for the successful management of any company, both for productive reasons and for being able to manage and give an effective response to the customers.

Good big data management is key to compete in a globalized market. With employees, suppliers and customers physically spread across different cities and countries, the better the data is handled in an organization, the greater its ability to react to market demand and its competitors.

Databases are nowadays an indispensable pillar to manage all the information handled by an organization that wants to be competitive. However, at a certain point of development in a company, when growth is sustained and the objective is expansion, the doubt faced by many managers and system administrators is whether they should continue to use a database system, or if they should consider the leap to a data warehouse. When is the right time to move from one data storage system to another?

4 0
3 years ago
Write a program binary.cpp that reads a positive integer and prints all of its binary digits.
earnstyle [38]

Answer:

View image below.

Explanation:

They're just asking you to create a num2bin function on Cpp.

If you search for "num2bin in C", you can find a bunch of answers for this if you think my solution is too confusing.

One way to do it is the way I did it in the picture.

Just copy that function and use it in your program. The rest you can do yourself.

5 0
2 years ago
The __________ contains a list of all the resources owned by the library.
mario62 [17]

The catalog contains a list of all the resources owned by the library.

- Mabel <3

8 0
3 years ago
Other questions:
  • In your presentation you added a text box to?
    5·1 answer
  • Write a program that reads in an integer value for n and then sums the integers from n to 2 * n if n is nonnegative, or from 2 *
    5·1 answer
  • A person painting his house dumps the unused paint on the ground. Which of the following resources will this most likely pollute
    14·1 answer
  • In a Windows environment, __________ is a powerful tool that enables security administrators to share user and group definitions
    10·1 answer
  • Create pseudocode that could be used as a blueprint for a program that would do the following: An employer wants you to create a
    12·1 answer
  • A foreign exchange student brought his desktop computer from his home in Europe to the United States. He brought a power adapter
    9·1 answer
  • When all the system testing and bugs correction has done, the software product will be delivered to the user for __________.
    15·1 answer
  • On tool hackers use to get sensitive information from victims is/are:
    15·2 answers
  • What was Ada Lovelace's contribution to computer science?
    13·2 answers
  • Posts that you delete
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!