Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 5, Problem 2E
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that asks the user to enter two
numbers between 200 and 1000, inclusive.
If any of the numbers entered is outside the range
above, display the message "Invalid number" and exit
the program using System.exit(0);
If the numbers are within the range, add the two
numbers together and display the result.
Write a program that asks for the starting time and the number of minutes of the call, and displays the charges.
The program should ask for the time to be entered as a floating-point number in the form HH.MM. For example, 07:00 hours will be entered as 07.00, and 16:28 hours will be entered as 16.28.
Write a program that accepts two characters and display the message “The characters are not the same” if the characters are different, and quits if the characters are the same.
Chapter 5 Solutions
Programming in C
Ch. 5 - Type in and run the 12 programs presented in this...Ch. 5 - Write a program that asks the user to type in two...Ch. 5 - Write a program that accepts two integer values...Ch. 5 - Write a program that acts as a simple printing...Ch. 5 - You developed Program 4.9 to reverse the digits of...Ch. 5 - Write a program that takes an integer keyed in...Ch. 5 - Program 5.10 has several inefficiencies. One...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Consider the following skeletal C program: void fun1(void); / prototype / void fun2(void); / prototype / void f...
Concepts Of Programming Languages
ShiftSupervisor Class In a particular factory, a shift supervisor is a salaried employee who supervises a shift...
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Give the name of the algorithm that results from each of the following special cases: a. Local beam search with...
Artificial Intelligence: A Modern Approach
Let Ly=y+py+qy. Suppose that y1 and y2 are two functions such that Ly1=f(x)andLy2=g(x). Show that their sum y=y...
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
Give the definitions of the constructors for the class TitledEmployee that you gave as the answer to Self-Test ...
Problem Solving with C++ (9th Edition)
What is a persistent object?
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
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
- Write a program that asks the user to enter a day (from 1 to 31), a month (from 1 to 12), and a two digityear. The program should then determine whether the month times the day is equal to the year. If so, itshould display a message saying the date is magic. Otherwise, it should display a message saying the date isnot magic. Note: Assume that the user will never enter an invalid day, month, or year.arrow_forwardWrite a program that prompts the user to enter five test scores and then prints the average test score. Indicate the average test score by printing it to the terminal. Average test score is X (Assume that the test scores are decimal numbers)arrow_forwardWrite a program that prompts the user to enter five test scores and then prints the average test score. Indicate the average test score by printing it to the terminal using the following format: Your average test score is: X (Assume that the test scoores are decimal numbers.)arrow_forward
- Write a program that asks the user to enter a password consisting of 7 characters. If the user enters a password which is not exactly 7 characters, the program should ask the user to enter a password again until the user complies. If the user enters a password which is less than 7 characters, the program should produce a message saying “The password is too short. Only passwords with 7 characters are accepted. Try again.” If the user enters a password which is more than 7 characters, the program should produce a message saying “The password is too long. Only passwords with 7 characters are accepted. Try again.” answer quicklyarrow_forwardWrite a program that gets the number and a letter. If the letter is ‘f’, the program should treat the number entered as temperature in degrees Celsius and convert it into the temperature in degree Fahrenheit and print a suitable message. If the letter is ‘c’, the program should consider the number as Fahrenheit temperature and convert it to Celsius temperature and print a suitable message. The program should display error message and then exit if the user enters any other letter. Use c++ language to implement this program. …………………………………………………………………………………………………Formulas: Celsius to Fahrenheit: 9.0/5.0 * value + 32 Fahrenheit to Celsius: 5.0/9.0 * (value-32) Note: Do this using Switch statement.arrow_forwardWrite a program that computes the average temperature of Jeddah over one week. The user must be prompted to enter the temperature of seven days, one at time. If an entered temperature value is less than -10oC or greater than 70oC, the user must be shown the following message and prompted to enter that value again. “Temperature of Jeddah cannot be less than -5oC or greater than 70oC. Please enter again: ” Finally, print out the average temperature up to decimal places. Note: The average value of N temperature readings can be computed by adding those N readings and then dividing the sum by N. Remember to use appropriate datatypes. in c languagearrow_forward
- Write a program that asks the user to type a vowel from the keyboard. If the character entered is a vowel, display “OK”; if it is not a vowel, display an error message. Be sure to allow both uppercase and lowercase vowels. The program continues until the user types ‘!’.arrow_forwardWrite a program that prompts the user to enter five test scores and then prints the average test score. Indicate the average test score by printing it to the terminal using the following format: Your average test score is: Xarrow_forwardWrite a program that computes the average temperature of Jeddah over one week. The user must be prompted to enter the temperature of seven days, one at time. If an entered temperature value is less than -10oC or greater than 70oC, the user must be shown the following message and prompted to enter that value again. “Temperature of Jeddah cannot be less than -5oC or greater than 70oC. Please enter again: ” Finally, print out the average temperature up to decimal places. Note: The average value of N temperature readings can be computed by adding those N readings and then dividing the sum by N. Remember to use appropriate datatypes.arrow_forward
- Write a program that asks the user for a number in the range of 1 through 7. The programshould display the corresponding day of the week, where 1 = Monday, 2 = Tuesday, 3 =Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program shoulddisplay an error message if the user enters a number that is outside the range of 1 through 7arrow_forwardWrite a program that calculates the factorial of a number N, where N is requested from the user.The factorial of a number is: If N=0 or N=1, the factorial is 1If N is any positive number it is calculated asN! = 1 * 2 * 3 * ... * N. For example, factorial of 4 is 1 * 2 * 3 * 4 = 24 If the user enters a negative value, the following message should be displayed:"Undefined factor for negatives"arrow_forwardWrite a program that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1, ..., and Saturday is 6). Also prompt the user to enter the number of days after today for a future day and display the future day of the week.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY