Join Telegram Channel for DXC exam Discussion & help!

wants to print the following pattern on the screen:

wants to print the following pattern on the screen:

1
1 2
1 2 3

He writes the following program:

integer i = 1 // statement 1

while ( i <= 3 )

{

int j // Statement 2

while ( j <= i ) // Statement 3

{

print j

print blank space

j = j + 1 // Statement 4

}

print end-of-line \takes the cursor to the next line

i = i + 1

}

Will this program function correctly? If not which one statement will you modify to

make the program function correctly?

Option 1 : Statement 1

Option 2 : Statement 2

Option 3 : Statement 3

Option 4 : Statement 4

Option 5 : Program does not have error.

Answer: Option 2

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.