Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the output from each of the following segments of code? 1. int a = 5; int b = 25; while (a < b)

What is the output from each of the following segments of code?

1.

int a = 5;

int b = 25;

while (a < b)

{

cout << "UCA Bears ";

a = a + 6;

}

//Answer:

2.

int a = 4;

int b = 7;

do

{

a = a + 1;

cout << a << " " << b << endl;

} while (a <= b);

//Answer:

3.

int a = 2;

while(a < 1)

{

a = a + 1;

cout << a;

}

cout << a << endl;

//Answer:

4.

int power = 4;

do

{

power = power * 2;

}while(power <= 32);

cout << power << endl;

//Answer:

5.

int a = 4;

int b = 10;

while(a < b)

a = a * 2;

cout << a << << b << endl;

//Answer:

6.

int a = 2;

while( a < 15)

{

a = a + 4; cout << a << endl;

}

//Answer:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions