शुरू करेंमुफ़्त में शुरू करें

Multiply and prosper

आपकी जॉब डिस्क्रिप्शन बदल गई है! अब आपके पास flexible hours और week के दिनों में लचीलापन है. आपको पता है कि आप पहले बनाया हुआ squareOf5() इस्तेमाल करके आसानी से जवाब तक पहुँच सकते हैं.

यह अभ्यास पाठ्यक्रम का हिस्सा है

इंटरमीडिएट Java

पाठ्यक्रम देखें

अभ्यास निर्देश

  • n1 और n2 को उनका सही टाइप दें.
  • n1 और n2 के बीच multiplication के लिए उचित ऑपरेटर का इस्तेमाल करें.
  • mult() के return value को रखने के लिए hours को सही टाइप दें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

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");
  }
}
कोड संपादित करें और चलाएँ