What will be the output of
int n=4;
while (n <=13)
{ n +=3;
if (n>9)
break;
}
cout<<n;
What will be the output of
n=2;
bool stop =false;
do
{ n +=3;
cout<<n;
if(n%2==0)
stop=true;
} while (n <=13 && !stop);
What will be the output of
void fun (int &, int &, int &):
int main ()
{
int a=2, b=3, c=4;
fun ( c, b, a );
cout << a << b << c;
return 0;
}
void fun (int & x, int & y, int & z)
{
int t = z; z = y; y = x; x = t;
}
The first one is 10, the 'break' after the if loop in the while loop terminates it earlier then its supposed to. It loops only twice rather then 3 times and each loop adds a 3 to the initial 4. 4+3+3 = 10.
The next one will loop in the do loop until 'if' terminating statement is satisified, in this case n%2 == 0 (in other words divisible by 2 ). you start by incrementing 3 on 2 to which makes 5, the loop keeps incrementing until n reaches a figure which is divisible by 2, in this case 58. n = 58
Luki you are real help the rest of these guys must not know what they are doing...I just need help THANK YOU A LOT...I hope good things happen for you...Keep helping.
The next one will loop in the do loop until 'if' terminating statement is satisified, in this case n%2 == 0 (in other words divisible by 2 ). you start by incrementing 3 on 2 to which makes 5, the loop keeps incrementing until n reaches a figure which is divisible by 2, in this case 58. n = 58
Luki you are real help the rest of these guys must not know what they are doing...I just need help THANK YOU A LOT...I hope good things happen for you...Keep helping.
Yeah, coz rest of us don't know how to do someone else's home work.