The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Bhavya wants to make a program to print the sum of all perfect squares, where the value of the squares go from 0 to 50. She writes the following program:
integer i = 1, a // statement 1
integer sum = 0
while ( a < 50 ) // statement 2
{
sum = sum + a // statement 3
i = i + 1
a = ( i * i ); // statement 4
}
print sum
Does this program have an error? If yes, which one statement will you modify to correct the program?
Op 1 : Statement 1
Op 2 : Statement 2
Op 3 : Statement 3
Op 4 : Statement 4
Op 5 : No error
-----------