100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Prep c++ loop exam questions & answers 2024/2025 $7.99   Add to cart

Exam (elaborations)

Prep c++ loop exam questions & answers 2024/2025

 5 views  0 purchase
  • Course
  • Prep c++ loop
  • Institution
  • Prep C++ Loop

Prep c++ loop exam questions & answers 2024/2025 for(x=1;x<=10;x=x+1) cout << x <<endl; - ANSWERS1 2 3 4 5 6 7 8 9 10 x=8; while (x < 10 ) x= x + 1; cout << x; - ANSWERS10 Write a loop condition for a loop that will exit when 10 numbers have been accepted or the...

[Show more]

Preview 2 out of 6  pages

  • August 4, 2024
  • 6
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • Prep c++ loop
  • Prep c++ loop
avatar-seller
Bensuda
Prep c++ loop exam questions &
answers 2024/2025

for(x=1;x<=10;x=x+1) cout << x <<endl; - ANSWERS1 2 3 4 5 6 7 8 9 10



x=8;

while (x < 10 )

x= x + 1; cout << x; - ANSWERS10



Write a loop condition for a loop that will exit when 10 numbers have been accepted or the user has
entered 0 (zero) as a number . ( loop condition to be one complex condition) - ANSWERSwhile ((count
<=10)&&(num !=0))



Write a loop that will accept numbers from a user as long as he wishes to enter numbers. Calculate the
sum of all numbers that were entered and when the user exits the loop, display the sum and average of
the numbers entered. - ANSWERSsum=0;

count =0;

reply ='y';

while(reply == 'y' || reply =='Y')

{

cout <<"Enter a number";

cin>>num;

sum=sum+num;

count=count+1;

cout <<" Do you wish to enter more numbers ?"; cin>>reply;

}

cout <<" Sum of all numbers entered is :"<<sum << endl;

cout <<" Count of all numbers entered is :"<<count <<endl;

cout <<" Average of all numbers entered is :"<<sum/count<<endl;

, What is the output of this nested loop ? i = 4;

while( i >= 1)

{

j= 1;

while (j > = 1) {

cout << j;

j = j - 1;

}

cout << i << endl; i = i - 1;

} - ANSWERS14 13 12 11



What does the following loop print out ?



number = 1;

while (number < 11)

{

number = number + 1;

cout<< number;

} - ANSWERS234567891011



By rearranging the order of statements ( do not change the way they are written), make the loop in the
question above print numbers from 1 to 10. - ANSWERSnumber = 1;

while (number < 11) {

cout<< number;

number = number + 1;

}

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Bensuda. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73243 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.99
  • (0)
  Add to cart