lelandcollins27
Sep 27, 2008, 03:50 PM
int secret(int x)
{
int I, j;
I = 2 * x;
if (I > 10)
j=x/2;
else
j = x/3;
return j - 1;
}
int another (int a, int b)
{
int I, j;
j = 0;
for (I = a; I <=b; I++)
j = j + I;
return j;
}
what is the output of the following segments
a. x=10
cout << secret(x) << endl;
b. x=5; y=8;
cout << another(x,y) <<endl;
c. x=10; k=secret(x);
cout << x << " " << k <<" " << another (x,k) <<endl;
d. x=5; y=8;
cout << another(y,x) <<endl;
{
int I, j;
I = 2 * x;
if (I > 10)
j=x/2;
else
j = x/3;
return j - 1;
}
int another (int a, int b)
{
int I, j;
j = 0;
for (I = a; I <=b; I++)
j = j + I;
return j;
}
what is the output of the following segments
a. x=10
cout << secret(x) << endl;
b. x=5; y=8;
cout << another(x,y) <<endl;
c. x=10; k=secret(x);
cout << x << " " << k <<" " << another (x,k) <<endl;
d. x=5; y=8;
cout << another(y,x) <<endl;