public class Solution
{
    public static void main(String[] args) throws Exception
    {
        //add your code here
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        int[] lista=new int[10];

        //fill array with int values from keyboard
        for (int i=0; i<lista.length; i++) {
            lista[i]=Integer.parseInt(reader.readLine());
        }
        // sort array
        boolean sorted=false;
    while (!sorted) {
        sorted=true;
        for (int i=0; i<(lista.length-1); i++) {
            if (lista[i]<lista[i+1]) {
                int temp = lista[i];
                lista[i]=lista[i+1];
                lista[i+1]=temp;
                sorted=false;
            }
        }
    }
        //display sorted array
        for (int i=0; i<lista.length; i++) {
        System.out.println(lista[i]);
    }
    }
}

I have no idea why this one does not pass the test. I hate the fact that it's only 10 levels avilable and I'm already in 7th. This is the best course ever!!!! I helped myself reading next lesson. I understood the task wrong. It didn't mean to sort the numbers descending and display it but just to arrange the elements in reverse order as they were input (the last element goes first, the second from end becomes secont etc).

asked 29 Dec '17, 15:10

spike's gravatar image

spike
11
accept rate: 0%

edited 31 Dec '17, 11:02


You don't need to arrange by value. Just sort array in reverse order. For example: input 123 1 43 output 43 1 123

link

answered 08 Apr, 02:54

Muerto's gravatar image

Muerto
11
accept rate: 0%

In order to save you from expensive games in Steam store we have created this post about How to get Free Steam Wallet Codes and Gift Cards http://www.abitgames.com/free-steam-wallet-codes-keys/

link

answered 14 Apr, 08:15

jack44's gravatar image

jack44
111
accept rate: 0%

In this article, I share with Xbox one emulator for PC no password no survey. This emulator will help you to play your Xbox one game on your computer. https://www.appn2o.com/best-xbox-one-emulator-for-windows-pc/

link

answered 14 Apr, 08:16

jack44's gravatar image

jack44
111
accept rate: 0%

public class Solution

{

public static void main(String[] args) throws Exception
{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int[] array = new int[10];

    for (int i = 0; i < array.length; i++)
        array[i] = Integer.parseInt(reader.readLine());

    for (int i = 1; i <= array.length; i++)
        System.out.println(array[array.length - i]);
}

}

link

answered 30 Aug, 07:39

Demotivator's gravatar image

Demotivator
11
accept rate: 0%

 public static void main(String[] args) throws Exception
{
   int arr[] = new int[10];
   int arr1[] = new int[10];
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
   for(int i = 0; i < arr.length; i++)
   {
       String s = reader.readLine();
       arr[i]=Integer.parseInt(s);
   }
   for(int i=0; i<arr.length; i++)
   {
      arr1[arr.length-1 -i] =arr[i]; 
   }

   for(int i = 0; i < arr.length; i++)
   {
       System.out.println(arr1[i]);
   }
link

answered 06 Nov, 17:05

Anna315510's gravatar image

Anna315510
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×69
×9
×5

Asked: 29 Dec '17, 15:10

Seen: 587 times

Last updated: 06 Nov, 17:05