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 3E
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 prompts the user for a radius and then prints
the diameter, circumference, and the area of a circle with that radius.
Use 3.14159 for the value of pi.
Hint: After your program gets the radius, convert it to a floating point using the float() function.
Below is a sample run with Python output in blue and user input in black. The user should be able to type any radius.
Enter radius:2.5
Diameter 5.0
Circumference 15.70795
Area 19.6349375
Write a program that reads a four-digit integer, such as 2014, and then displays it, one digit per line in reverse order, like so: 4 1 0 2 Your prompt should tell the user to enter a four-digit integer. You can then assume that the user follows directions. (Hint: Use the division andm remainder operators.)
Hi, I need help with the following assignment.
Implement a program that reads in a year and outputs the approximate value of a Ferrari 250 GTO in that year. Use the following table that describes the estimated value of a GTO at different times since 1962.
Year
Value
1962-1964
$18,500
1965-1968
$6,000
1969-1971
$12,000
1972-1975
$48,000
1976-1980
$200,000
1981-1985
$650,000
1986-2012
$35,000,000
2013-2014
$52,000,000
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
Alphabetic Telephone Number Translator Many companies use telephone numbers like 555-GET-FOOD so the number is ...
Starting Out with Java: From Control Structures through Objects (6th Edition)
Object reusability has been a factor in the increased use of object-oriented programming.
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Using an example of a component that implements an abstract data type such as a stack or a list, show why it is...
Software Engineering (10th Edition)
February Days The month of February normally has 28 days. But if it is a leap year, February has 29 days. Write...
Starting Out with Python (4th Edition)
The following algorithm is designed to print the beginning of what is known as the Fibonacci sequence. Identify...
Computer Science: An Overview (12th Edition)
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 generates and prints 50 random integers, each between 3 and 6. .Write a program that generates a random number, x, between 1 and 50, a random number y between 2 and 5, and computes x". .Write a program that generates a random number between 1 and 10 and prints your name that many times. .Write a program that generates a random decimal number between 1 and 10 with two decimal places of accuracy. Examples are 1.23, 3.45, 9.80, and 5.00.arrow_forwardWrite a program which takes two float numbers from the user and check, if first number is greater than the second number, if the first number is greater add 5 in the first number and print the result., otherwise add 10 to second number and print the result.arrow_forwardWrite a program which repeatedly reads several people's height numbers in cm(centimeter) until the user enters "done". Once "done" is entered, print out the max, min, and average of the height numbers. Correct height data should be number between 50cm and 250cm. If the user enters number out of the range, or anything other than a number, detect the mistake and print an error message and skip to the next number. Sample input and output: Enter a height: 300 Invalid input Enter a height: 10 Invalid input Enter a height: 200 Enter a height: good Invalid input Enter a height: 180 Enter a height: 165 Enter a height: done Max: 200.0 Min: 165.0 Average: 181.67arrow_forward
- Write a program that reads an integer and checks whether the number is odd or even.You should use the modulus operator (%) to test if the number is odd or even.Example of user dialogue:Enter an integer: 1313 is an odd number.Testing:Try entering different integers, also try with 0 and negative integers.arrow_forwardWrite a program that reads two integers, a and b, from the user. Where a is equal to 17 and b is equal to 4. The program should compute and display the following: i. Sum of a and b. ii. Difference when b is subtracted from a. ii. Result of a. iv. Remainder when a is divided by b.arrow_forward2. Write a program that converts a hexadecimal digit into a decimal value. (The output of your program should be like the following but you should try different numbers.) Enter a hex digit: AB7C You must enter exactly one character Enter a hex digit: B The decimal value for hex digit 8 is 11 Enter a hex digit: 8 The decimal value for hex digit 8 is 8 Enter a hex digit: T T is an invalid inputarrow_forward
- Write a Python program that reads an integer representing a month of the year, and then print the name of the month. Your program must include validation and error handling code. Thus, if the user enters a value outside the range of 1-12; or characters that cannot be converted to an integer, your code must print the appropriate message and continue without crashing. (Hint: You may NOT USE any 'if' statements.)arrow_forwardWrite a program that takes a positive integer as the height of the triangle and prints an alphabetical triangle, using lowercase English letters as shown below. Each subsequent row of the triangle should increase in length by two letters. Make sure your program validates the user input. If the user does not input a positive integer, print "Invalid input."arrow_forward(This is a better version of an exercise from Chapter 1.) A government research lab has concluded that an artificial sweetener commonly used in diet soda pop causes death in laboratory mice. A friend of yours is desperate to lose weight but cannot give up soda pop. Your friend wants to know how much diet soda pop it is pos- sible to drink without dying as a result. Write a program to supply the answer. The input to the program is the amount of artificial sweetener needed to kill a mouse, the weight of the mouse, and the desired weight of the dieter. Assume that dietsoda contains 1/10th of 1% artificial sweetener. Use a named constant for this fraction. You may want to express the percent as the double value 0.001.arrow_forward
- Write a program that will read value of the radius to compute the Area and Perimeter of a Circle. Use the formulas below: area = Pi * radius * radius perimeter = 2 *Pi * radius Where value of Pi is 22/7 = 3.14 Display the computed area and perimeter.arrow_forwardHi, thank you for your solution. When I try to run the program it gives me the following error:arrow_forwardWrite a program that reads in three integers and then determines and prints the largest and the smallest integers in the group. Use only the programming techniques you have learned in this chapter.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