Jump to content

Tadeu Junior

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Tadeu Junior

  1. 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

×
×
  • Create New...