Blog
Thursday 2 December 2010
Write down the output of the following code?
int array[7], sum = 0;
for(int i=0;i<7;i++)
{
array[i] = i;
sum+= array[i];
}
cout<< “ Sum = “ <<sum;
Loop will run times starts from zero and add values from 1 to 6 which is equal to 21
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment