Jump to content

Changes in to code´s language


Tadeu Junior

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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...