मराठी

Observe the following code. It may contain Syntax, Logical or runtime errors int fnJob(int n) { while (n>0) { int d = n%10; n = n/10; return d; } }

Advertisements
Advertisements

प्रश्न

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

int fnJob(int n)
{
    while (n>0)
    {
      int d = n%10;
      n = n/10;
      return d;
    }
}
कोड लेखन
Advertisements

उत्तर

int fnJob(int n)
{
    while (n>0)
    {
        int d = n % 10;
        n = n / 10;
        return d;
    }
    return 0;
}
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 3: User-Defined Methods - Exercises [पृष्ठ ९२]

APPEARS IN

रूपा पंडित Computer Applications [English] Class 10 ICSE
पाठ 3 User-Defined Methods
Exercises | Q 7. (vi) | पृष्ठ ९२
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×