Question

Problem 3: (20) write a for loop that produces the song Bottles of Beer on the Wall: 10 bottles of beer on the wall, 10 bottles of beer Take one down, pass it around, 9 bottles of beer on the wall 9 bottles of beer on the wall, 9 bottles of beer Take one down, pass it around, 8 bottles of beer on the wall (output continues in the same pattern)... 1 bottles of beer on the wall, 1 bottles of beer Take one down, pass it around, 0 bottles of beer on the wall
0 0
Add a comment Improve this question Transcribed image text
Answer #1

solution:

int i;View Project Build Debug Iools Window Help Airplane mode off x main #include<stdio.h> 3 int main) 4 inti for (i = 10; î >=1 ;

for(i = 10; i >=1; i--) // here i is of integer type, for loop runs till it reaches to 1,

{

printf("%d bottles of beer on the wall, %d bottles of beer\n",i,i); // here %d is delimiter of i which prints the value

printf("Take one down, pass it around, %d bottles of beer on the wall \n",i-1); // decremented value will be printed

}

Add a comment
Know the answer?
Add Answer to:
Write a for loop that produces the song Bottles of Beer on the Wall: 10 bottles...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (Python) 3. 99 Bottles of Beer on the Wall song, recursively Write a function Recurse that...

    (Python) 3. 99 Bottles of Beer on the Wall song, recursively Write a function Recurse that prints out the verses of the famous song, Lyrics of the song 99 Bottles of Beer (shown below). You must called this function recursively. 99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall. 98 bottles of beer on the wall, 98 bottles of beer. Take one down and...

  • Java hw Write a program that outputs the lyrics for “Ninety-nine Bottles of Beer on the...

    Java hw Write a program that outputs the lyrics for “Ninety-nine Bottles of Beer on the Wall.” Your program should print the number of bottles in English, not as a number. For example: Ninety-nine bottles of beer on the wall, Ninety-nine bottles of beer, Take one down, pass it around, Ninety-eight bottles of beer on the wall. ... One bottle of beer on the wall, One bottle of beer, Take one down, pass it around, Zero bottles of beer on...

  • Problem 1 Write a program that outputs the lyrics for “Ninety-nine Bottles of Beer on the...

    Problem 1 Write a program that outputs the lyrics for “Ninety-nine Bottles of Beer on the Wall.” Your program should print the number of bottles in English, not as a number. For example: Ninety-nine bottles of beer on the wall, Ninety-nine bottles of beer, Take one down, pass it around, Ninety-eight bottles of beer on the wall. ... One bottle of beer on the wall, One bottle of beer, Take one down, pass it around, Zero bottles of beer on...

  • C++ Help!    For this lab, we are going to practice a few different aspects of...

    C++ Help!    For this lab, we are going to practice a few different aspects of programming in C++. ·        Practice using cin and cout. ·        Practice using a loop (for or while) ·        Practice using a c-string. For this lab, you are going to create the code that writes the lyrics for the old song, “99 Bottles of Beer” with a slight change. If you have never seen the song, you can view the lyrics here: http://www.99-bottles-of-beer.net/lyrics.html Our version...

  • C SHARP PROGRAM LANGUAGE The program below isn't working quite right. First compile and run it...

    C SHARP PROGRAM LANGUAGE The program below isn't working quite right. First compile and run it to familiarize yourself with the output. Then update the program to implement the following requirements: 1. the program shall sing ( display with WriteLine() ) the song's verses for drinks 100 through 91. 2. the program shall not sing the song's verses for drinks 90 - 7. 3. the program shall implement a string variable which is initialized by the programmer to the type...

  • Questions 25-26. A small brewery has two bottling machines. Machine 1 produces 75% of the bottles...

    Questions 25-26. A small brewery has two bottling machines. Machine 1 produces 75% of the bottles of beer while Machine 2 produces 25%. One out of every 20 bottles lled by Machine 1 is rejected because of poor quality, while one out of every 10 bottles from Machine 2 is rejected. 25. What percentage of bottles is rejected? (a) 7.5% (b) 6.25% (c) 8.75% (d) 40% (e) None of the answers is correct. 26. What is the probability that a...

  • Write while loop to display the numbers from 10 through 1 and the squares. The output...

    Write while loop to display the numbers from 10 through 1 and the squares. The output should display as following: n squared 10 100 9 81 8 64

  • The task is to write Song.cpp to complete the implementation of the Song class, as defined...

    The task is to write Song.cpp to complete the implementation of the Song class, as defined in the provided header file, Song.h, and then to complete a program (called sales) that makes use of the class. As in Project 1, an input data file will be provided containing the song name and other information in the same format as in Program 1: Artist    Song_Title    Year    Sales    Medium As before, the program (sales) which are individual copies, will use this information to compute the gross...

  • Hi! Need help with these questions! With explaining please Ginger Beer making Q8-12 I can charge...

    Hi! Need help with these questions! With explaining please Ginger Beer making Q8-12 I can charge $10 per 2L bottle, have fixed costs of $200/week and variable costs of $4/bottle 8. At an output of 20 bottles, what is the marginal cost? a) $0 b) $4c) $10 d) $200 e) $210 9. At an output of 20 bottles, what is the marginal revenue? a) $0 b) $4 c) $10 d) $200 e) $210 10. How many do I need to...

  • Bubble Company produces a variety of bottles from recycled plastic. The company has one particular machine...

    Bubble Company produces a variety of bottles from recycled plastic. The company has one particular machine on which it can produce either of two types of water bottles, 1-liter bottles or 1/2-liter bottles. Sales demand for both products is such that the machine could operate at full capacity on either of the products, and Bubble can sell all output at current prices. One unit of the 1/2-liter product requires one hour of machine time per unit of output, and one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT