Computer Science: A Structured Programming Approach Using C, Third Edition
Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 5, Problem 48PS
Program Plan Intro

To create a program that writes a function named day_of_week that takes the user input, which must be in between 0 and 6, and displays the corresponding week's day.

Program Plan:

Create a program that writes a function named day_of_week.

The code takes the user input between 0 and 6.

The code displays the corresponding week's day. For example, Sunday(0), Monday(1), Tuesday(2), etc.

The code will work, in such a way, that Sunday is the 1st week’s day.

Blurred answer
Students have asked these similar questions
The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent number is the sum of the two preceding numbers. The first several numbers in the sequence are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, etc. Write a function named fib that takes a positive integer parameter and returns the number at that position of the Fibonacci sequence. For example fib(1) = 1, fib(3) = 2, fib(10) = 55, etc. Your function does not need to print anything out - just return a value. For example, your function could be called like this: term = fib(17) You cannot use recursion, since we haven't covered that technique. That means that for this assignment you cannot have your function call itself. This includes indirect recursion, such as one function calling a second function that calls the first function. You must use a loop to step through the sequence - do not use the golden ratio to directly calculate the value.
When it is 8:00 in Lubbock, • It is 9:00 in New York • It is 14:00 in London • It is 15:00 in Cairo • It is 16:00 in Istanbul • It is 19:00 in Hyderabad • It is 22:00 in Tokyo Write a function that reports the time in New York, London, Cairo, Istanbul, Hyderabad, and Tokyo based on the time in Lubbock. Use a 24-hour time format. Include error trapping that: 1. Issues a message like "Please Enter A Number from 00 to 23" if the first input is numeric but outside the range of [0,23]. 2. Takes any numeric input for "Lubbock time" selection , and forces it into an integer. 3. Issues an appropriate message if the user's selection is non-numeric. Test your function for these times: • 8:00 • 15:00 • 0:00 In [ ]: # script goes here
Write a function that computes the average of the digits in an integer. Use the following function header: double averageDigits(long n)

Chapter 5 Solutions

Computer Science: A Structured Programming Approach Using C, Third Edition

Ch. 5 - There are two different ways to implement a...Ch. 5 - Which of the following statements about switch...Ch. 5 - Which of the following statements about the...Ch. 5 - Prob. 14PSCh. 5 - Prob. 15PSCh. 5 - If x=0,y=5,z=5, what is the value of x, y, and z...Ch. 5 - If x=3,y=0,andz=4, what is the value of the...Ch. 5 - Simplify the following expressions by removing the...Ch. 5 - Prob. 19PSCh. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=4,y=0,andz=2, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=0,y=0,andz=1, what is the value of...Ch. 5 - If originally x=2,y=1,andz=1, what is the value of...Ch. 5 - If originally x=1,y=3,andz=0, what is the value of...Ch. 5 - Evaluate the value of the following expressions:...Ch. 5 - Evaluate the value of the following expressions:...Ch. 5 - Write an if statement that will assign the value 1...Ch. 5 - Prob. 36PSCh. 5 - Write the code to add 4 to an integer variable,...Ch. 5 - Prob. 38PSCh. 5 - Write the code to print either zero or not zero...Ch. 5 - If the variable divisor is not zero, divide the...Ch. 5 - Prob. 41PSCh. 5 - Rewrite the following code using one if statement:...Ch. 5 - Rewrite the following code fragment using one...Ch. 5 - Write a code fragment that tests the value of an...Ch. 5 - Prob. 45PSCh. 5 - Prob. 46PSCh. 5 - Write a function called smallest that, given three...Ch. 5 - Prob. 48PSCh. 5 - Write a function called month_of_year that, given...Ch. 5 - Write a function called parkingcharge that, given...Ch. 5 - Prob. 51PSCh. 5 - Complete the incremental implementation of Program...Ch. 5 - Write a program that determines a student's grade....Ch. 5 - Prob. 54PSCh. 5 - Given a point, a line from the point forms an...Ch. 5 - Prob. 56PSCh. 5 - Write a program that asks the user to enter the...Ch. 5 - Prob. 58PSCh. 5 - This program is a simple guessing game. The...Ch. 5 - Write a program that, given a person's birth date...Ch. 5 - Write a program that calculates the change due a...Ch. 5 - Write a menu-driven program that allows a user to...Ch. 5 - Write a program that tests a user-entered...Ch. 5 - Write a program to compute the real roots of a...
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
functions in c programming | categories of function |; Author: Education 4U;https://www.youtube.com/watch?v=puIK6kHcuqA;License: Standard YouTube License, CC-BY