Jump to content

Changes in to code´s language


Recommended Posts

Hi!

I would like to know if it is possible to convert the code that was wrote based on JavaScript to Java or Kotlin. What type of commands do I need to do, to make these changes? This one is part of a BootCamp´s exercises that I am engaged in. Below, the code and IDE´s print:

for (i = 0; i < 3; i++) {

    let t = gets();
    let v = gets();

    let arrayV = v.split(" ");

    let maior = 0;
    let nivel = 0;

    maior = arrayV.reduce((a, b) => (
      Math.max(a, b)
    )) 

    if (maior < 10) {

        nivel = 1;

    } else if (maior < 20) {

        nivel = 2;

    } else {

        nivel = 3
    }

    console.log(nivel)

}

 

Execution s - IDE..png

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...