English

Some of the code given below contains errors. Identify the error and correct it. Write the output of the correct/corrected code. int HC[ ] = {1, 2, 3, 4, 5, 6}; int n = HC.length -1; for(int j = 0; j

Advertisements
Advertisements

Question

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

int HC[ ] = {1, 2, 3, 4, 5, 6};
int n = HC.length -1;
for(int j = 0; j <=n/2; j++)
{
    HC[j] = HC[n-j];
System.out.println(" The array is: ");
for( intj = 0; j <HC.length; j++)
System.out.print("" + HC[j]);
Very Short Answer
Advertisements

Solution

No Error. Output: The array is : 6544 56

shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Arrays - One Dimension - Exercises [Page 175]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 7 Arrays - One Dimension
Exercises | Q 3. (x) | Page 175
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×