Tuesday, November 12, 2013

C++ For Loop Program Conversion to If Else Statement Program

Given the following C++ code:
     int j, sum = 0;     for (j = 0; j < 10; j++)     sum += j;
     cout<<sum;
Re-write the C++ statements so that they compute the same quantity but using decision statement (if-else) instead of for loop.

No comments:

Post a Comment

Please comment, if you like the post, you find any mistake or if you have any query.