मराठी

Some of the code given below contains errors. Identify the error and correct it. Write the output of the correct/corrected code. int WH[] = {11, 22, 33, 44, 55, 66, 77}; int n = WH.length -1; for(int

Advertisements
Advertisements

प्रश्न

Some of the code given below contains errors. Identify the error and correct it. Write the output of the correct/corrected code.

int WH[] = {11, 22, 33, 44, 55, 66, 77};
int n = WH.length -1;
for(int j = 0; j<=n/2; j++)
{
    int tmp = WH[j];
    WH[j] =WH[n - j];
    WH[j] =WH[n - j];
}
System.out.print(" The array is: ");
for(int j = 0; j<WH.length; j++)
    System.out.print(" " + WH[j]);
अति संक्षिप्त उत्तर
Advertisements

उत्तर

No Error. Output : The array is: 77 66 55 44 33 22 11

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 7: Arrays - One Dimension - Exercises [पृष्ठ १७६]

APPEARS IN

रूपा पंडित Computer Applications [English] Class 10 ICSE
पाठ 7 Arrays - One Dimension
Exercises | Q 3. (xi) | पृष्ठ १७६
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×