English

Given: int PM[] = {650, 525, 475, 325, 250, 175 }; for (int p = 5; p>=1 ; p--) System.out.print (" % “ + PM[p]%100); The output will be ______.

Advertisements
Advertisements

Question

Given:

int PM[] = {650, 525, 475, 325, 250, 175 };
for (int p = 5; p>=1 ; p--)
System.out.print (" % “ + PM[p]%100);

The output will be ______.

Options

  • % 50, %2 5, %75, %25, %50, %75

  • % 75 % 50 % 25 % 75 % 25

  • 75 % 50 % 25 % 75% 25%

  • % 175 % 250 % 325 % 475 % 525

MCQ
Fill in the Blanks
Advertisements

Solution

The output will be % 175 % 250 % 325 % 475 % 525.

Explanation:

The loop starts from index 5 and moves backward to index 1. For each element, the remainder after dividing by 100 is calculated using the modulus % operator. The results 75, 50, 25, 75, and 25 are printed, each preceded by the % symbol. Therefore, the output is % 75 % 50 % 25 % 75 % 25.

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

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×