Join Telegram Channel for DXC exam Discussion & help!

wants to make a program to print the sum of all perfect cubes, where the value of the cubes go from 0 to 100. She writes the following program:

wants to make a program to print the sum of all perfect cubes, where the value of the cubes go from 0 to 100. She writes the following program:

integer i = 0, a // statement 1
integer sum = 0;
a = ( i * i * i )
while ( i < 100 ) // statement 2
{
sum = sum + a // statement 3
i = i + 1
a = ( i * i * i ) // statement 4
}
print sum

Does this program have an error? If yes, which one statement will you modify to correct the program?

Option 1 : Statement 1

Option 2 : Statement 2

Option 3 : Statement 3

Option 4 : Statement 4

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.