Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 6, Problem 3E
Program Plan Intro
Program Plan:
- Include required header files.
- Declare the function “main ()”.
- Declare required variables “ratingCounters [11]”, “i”, “j”, “response”.
- Loop from 1 through 10.
- Assign “0” to the array index.
- Do until the “while” condition “response!=999” fails.
- Get the response from the user.
- Check the condition “response < 1 || response > 10”.
- Print the error message.
- Else, increment the counter.
- Increment the variable “i”.
- Loop from 1 through 10
- Print the number of responses.
- Return the statement.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Implement programs involving the use of while, do..while and for loop
statement.
Objectives:
Topics Covered:
Implementing programs using loops.
Description
FRIDAY THE 13TH
When will Friday the 13th occur in 1990? Write a program that will
find all months in 1990 in which the 13th falls on a Friday.
You need to know the following.
1. January 1, 1990 was on a Monday.
2. September, April, June, and November have thirty days, all the rest
have 31 except for February which has 28 except in leap years when it has 29.
3. 1990 is not a leap year.
Note: To make it fair for everyone, you may not use any built-in date
functions from your computer language.
Sample Output if Applicable
Sample Run
In 1990, Friday the 13th occurs in the months:
APRIL
A semicolon (;) is necessary at the end of which type of the loop?
All loops
do-while
while
for
Write the syntax for a do/while loop that executes as long as a character variable has a value of either “y” or “Y”. (Assume the character variable is already declared, and give it a valid identifier name of your choosing, given that its purpose is to store the user’s response to the question “do you wish to input another set of data?”. You do not need to include any statements in the curly brackets for the loop.)
(** How do I do this in c**)
Chapter 6 Solutions
Programming in C
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- You need to write a loop that will repeat exactly 125 times. Which is the preferred loop construct to use? A. while B. do while loop C. for looparrow_forwardCarl wants to pick all of the flowers in his garden. Write an appropriate looping condition and its opposing loop exit condition.arrow_forwardcode bellow for ch in "john.smith@pythoninstitute.org": if ch == "@": break print (ch, end="")| Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it reaches after the @ symbol, and print the part before @ on one line. Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it complete the loop. Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it reaches before the @ symbol, and print the part before @ on one line. none of the above Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it reaches the @ symbol, and print the part before @ on one line.arrow_forward
- Q1: Secret Messages Implement a Caesar cipher to encrypt messages.arrow_forwardexplain the use of voids and why do we use it. explain also if else loopsarrow_forwardConsider the code below and select all that apply: X = 0 while True: if x % 2==1: break X=X+2 print(x) a. b. C. d. e. This is an infinite loop. The iterating variable changes but it is always even. The iterating variable never changes. The loop is executed once and prints the value of x as 1. The break command is never called.arrow_forward
- CODE USING C++ 3. Place Values by CodeChum Admin Manipulating values from a series of numbers is fun, but let's try exploring the use of loops a little more. How about printing out each digit of a number by place values, in ascending order? Instructions: Create a variable and input a random positive integer. Using while loop, print out each digit of the inputted integer in separate lines, starting from its rightmost digit until the leftmost digit of the number. Tip: Use % 10 to get the rightmost digit, and / 10 to remove it from the number. Another tip: don't forget to consider the case wherein the input is `0` Input A line containing an integer. 214 Output Multiple lines containing an integer. 4 1 2arrow_forwardn is an integer variable.Write a while loop that prints integer numbers starting with n and dividing the number to 4 each time, while the new number is greater than 0.(Example: If n is 2077, it will print 2077 519 129 ...)Write only the statements to perform the above explained task, nothing else.Use while loop, don't use for loop.arrow_forwardProgram - Python Write a program asking the user to keep entering in strings (ie names) until they enter the string “leave”, at which point you’ll exit the loop and tell them how many times they entered the string “gold”. This one requires that you use a loop and also keep a tally of the number of times they enter the string gold.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning