Rewrite the following code segment using a for loop

 

            Sum = 0;

            Count = 1;

            while (count <= 1000)

            {

                        Sum = Sum + Count;

                        Count++;

            }

 

 

Rewrite the following code segment as a while loop.

 

            for (m = 93; m >= 5; m--)

                        cout << m << ‘ ‘ << m * m << endl;

 

 

 

What is the output of the following code segment?  Assume all variable are correctly

declared.

 

 

            for (lastNum = 1; lastNum <= 7; lastNum++)

            {

                        for (numToPrint = 1; numToPrint <= lastNum; numToPrint++)

                                    cout << numToPrint;

                        cout << endl;

            }

 

 

What is the output of the following code segment?  Assume all variable are correctly declared.

 

 

            for (i= 1; i <= 5; i++)

            {

                        for (j = 1; j <= 3; j++)

                        {

                                    for (k = 1; k <= 4; k++)

                                                cout << “*”;

                                    cout << endl;

                        }

                        cout << endl;

            }