MYPROGRAMMINGLAB WITH PEARSON ETEXT
8th Edition
ISBN: 9780134225340
Author: Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 9, Problem 9.17E
(Using %g with Various Precisions) Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Average a Sequence of Integers) Write a program that calculates and prints the average ofseveral integers. Assume the last value read with scanf is the sentinel 9999. A typical input sequencemight be10 8 11 7 9 9999indicating that the average of all the values preceding 9999 is to be calculated
(Converting a given date to the day number in the year)
Write a program that prints the day number of the year, given the date is in the
form month day year. For example, if the input is 1 1 05, the day number is 1; if the
input is 12 25 05, the day number is 359. The program should check for a leap year. A
year is a leap year if it is divisible by 4 but not divisible by 100. For example, 1992 and
2008 are divisible by 4, but not by 100. A year that is divisible by 100 is a leap year if it
is also divisible by 400. For example, 1600 and 2000 are divisible by 400. However,
1800 is not a leap year because 1800 is not divisible by 400.
Directions:
Call 3 functions from your main.
One to input data (pass parameters in a list)
One to determine the result (use a value returning function to determine and
return the result)
One to display both the date and the result
You can use two Python dictionaries to represent the number of days in each
month for a regular and a leap year.
Ex.…
(Sum the digits in an integer) Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all its digits is 14.
Chapter 9 Solutions
MYPROGRAMMINGLAB WITH PEARSON ETEXT
Ch. 9 - Write a printf or scanf statement for each of the...Ch. 9 - (Differences Between %d and %i) Write a program to...Ch. 9 - (Printing Numbers in Various Field Widths) Write a...Ch. 9 - (Rounding Floating-Point Numbers) Write a program...Ch. 9 - (Temperature Conversions) Write a program that...Ch. 9 - (Escape Sequences) Write a program to test the...Ch. 9 - (Printing a Question Mark) Write a program that...Ch. 9 - (Reading an Integer with Each scanf Conversion...Ch. 9 - (Outputting a Number with the Floating-Point...Ch. 9 - (Reading Strings in Quotes) In some programming...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
In Self-Test Exercise 7, we saw that you could not add a definition for the following function (to the global n...
Problem Solving with C++ (10th Edition)
A(n) ____ is a piece of data that is sent into a module. a. argument b. parameter c. header d. packet
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Explain how entities are transformed into tables.
Database Concepts (8th Edition)
Declare method sphereVolume to calculate and return the volume of the sphere. Use the following statement to ca...
Java How To Program (Early Objects)
Is Java bytecode a high-level language or a low-level language?
Java: An Introduction to Problem Solving and Programming (7th Edition)
The _________ library function returns the natural logarithm of a number.
Starting Out with C++ from Control Structures to Objects (8th 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
- (Display a pattern) Write a program that displays the following pattern:JJ aaa v vaaaJ J aa v v a aJ aaaa v aaaaarrow_forward(Financials: currency exchange) Write a program that prompts the user to enter the exchange rate from currency in U.S. dollars to Rupees PKR. Prompt the user to enter 0 to convert from U.S. dollars to Rupees PKR and 1 to convert from Rupees PKR and U.S. dollars. Prompt the user to enter the amount in U.S. dollars or Rupees PKR to convert it to Rupees PKR or U.S. dollars, respectively. Use c++ program.arrow_forward(Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. *********** USE PYTHON ********* Sample Run 1 Sample Output 1: Enter an integer, the input ends if it is 0: 1 Enter an integer, the input ends if it is 0: 2 Enter an integer, the input ends if it is 0: -1 Enter an integer, the input ends if it is 0: 3 Enter an integer, the input ends if it is 0: 0 The number of positives is 3 The number of negatives is 1 The total is 5 The average is 1.25 Sample Run 2 Sample Output 2: Enter an integer, the input ends if it is 0: 0 No numbers are entered except 0arrow_forward
- (Inputting Decimal, Octal and Hexadecimal Values) Write a program to test the inputtingof integer values in decimal, octal and hexadecimal formats. Output each integer read by the program in all three formats. Test the program with the following input data: 10, 010, 0x10.arrow_forward(Limitations of Floating-Point Numbers for Monetary Amounts) Section 4.6 cautionedabout using floating-point values for monetary calculations. Try this experiment: Create a floatvariable with the value 1000000.00. Next add to that variable the literal float value 0.12f. Displaythe result using printf and the conversion specifier "%.2f". What do you get?arrow_forward(Phone key pads) The international standard letter/number mapping found on the telephone is shown below: 100 2 abc 3 def 4 ghi 5 ikl 6mno 7pgrs 8 tuv 9wxyz Write a program that prompts the user to enter a letter and displays its correspond- ing number.arrow_forward
- (Find the two highest scores)Write a program that prompts the user to enter the number of students and each student’s name and score, and displays the name and score of the student with the highest score and the student with the second-highest score.Sample RunEnter the number of students: 5Enter a student name: SmithEnter a student score: 60Enter a student name: JonesEnter a student score: 96Enter a student name: PetersonEnter a student score: 85Enter a student name: GreenlawEnter a student score: 98Enter a student name: ZhangEnter a student score: 95Top two students:Greenlaw's score is 98.0Jones's score is 96.0arrow_forward(Geometry: area of a hexagon) The area of a hexagon can be computed using the following formula (s is the length of a side): 6 x s? Area TT 4 X tan 6. Write a program that prompts the user to enter the side of a hexagon and displays its area. Here is a sample run:arrow_forward(Diameter, Circumference and Area of a Circle) Write a program that reads in the radiusof a circle and prints the circle’s diameter, circumference and area. Use the constant value 3.14159for π. Perform each of these calculations inside the printf statement(s) and use the conversion specifier %f. [Note: In this chapter, we’ve discussed only integer constants and variables. In Chapter 3we’ll discuss floating-point numbers, i.e., values that can have decimal points.]arrow_forward
- Find the error(s) in the following code: (6)arrow_forward(Geometry: distance of two points) Write a program that prompts the user to enter two points (x1, y1) and (x2, y2) and displays their distance between them. The formula for computing the distance is: Square root of ((x2 - x1) squared + (y2 - y1) squared) Note that you can use pow(a, 0.5) to compute square root of a. Sample Run Enter x1 and y1: 1.5 -3.4 Enter x2 and y2: 4 5 The distance between the two points is 8.764131445842194arrow_forward(IN C LANGUAGE) Binary-Decimal / Decimal Binary . Between 0 and 255 a number will be decided randomly by computer. Then asks to user 3 times a random digit of binary value of the that number. If user enters wrong number for a digit program will select another random number and ask random times random digit. For example: Computer selected number as 163 ( Which is 10100011) What is the digit 2 (question 1/3) :User enter 1 CorrectWhat is the digit 4 (question 2/3) : User enter 0 CorrectWhat is the digit 7 (question 3/3) : User enter 0 CorrectUser finished the quest with 3 input .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
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License