BaşlayınÜcretsiz Başlayın

Multiply and prosper

Your job description changed! Now you have flexible hours and days per week. You know you can build on that squareOf5() you built earlier to easily get the answer.

Bu egzersiz

Intermediate Java

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Give n1 and n2 their proper type.
  • Use the appropriate operator for multiplication between n1 and n2.
  • Give hours the right type to hold the return value of mult().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

class Multiplier {
  // Give these arguments the proper type
  static int mult(____ n1, ____ n2) {
    // Use the appropriate operator to get the multiplication of 2 numbers
    return n1 ____ n2;
  }

  public static void main(String[] args) {
    int n = 5, m = 6;
    // Give the correct type to hours to retrieve the return value of mult
    ____ hours = mult(n, m);
    System.out.println("I'm working " + hours + " hours a week");
  }
}
Kodu Düzenle ve Çalıştır