Quick Print – CSKC
Sign In

Search

siteicon
Solved Problem #CPP#5362 Back

Problem Statement - Output writing – Three for loops

Write the output of the following code. Assume all header files are included.

int main()
{
  int i;
  for(i=10; i>6; i=i-2) cout<<i<<" ";
  cout<<endl;
  for(i=-5; i> -8; i--) cout<<i+1<<" ";
  cout<<endl;
  for(i=-3,sum=0; i<3; i--) cout<<sum++<<" "; 
  cout<<endl;
  return 0;
}

Solution

		 

Run Output

10 8 
-4 -5 -6
0 1 2 3 4 5