हिंदी

Observe the following code. It may contain Syntax, Logical or runtime errors. int fnTale(int n) { if(n%2=0) { return(n*n); }

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 fnTale(int n)
{
   if(n%2=0)
   {
      return(n*n);
   }
   return(n*n* n);
}
अति संक्षिप्त उत्तर
Advertisements

उत्तर

No error. If n is even, then return its square, else return its cube.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 3: User-Defined Methods - Exercises [पृष्ठ ९२]

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×