C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 2.17E
(Printing Values with print!) Write a
- Using one printf statement with no conversion specifiers.
- Using one printf statement with four conversion specifiers.
- Using four printf statements.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(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.
(Calculating the Product of Odd Integers) Write a program that calculates and prints theproduct of the odd integers from 1 to 15.
(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.
Chapter 2 Solutions
C How to Program (8th Edition)
Ch. 2 - Identify and correct the errors in each of the...Ch. 2 - Fill in the blanks in each of the following: _____...Ch. 2 - Write a single C statement or line that...Ch. 2 - State which of the following are true and which...Ch. 2 - Prob. 2.11ECh. 2 - What, if anything, prints when each of the...Ch. 2 - Which, if any, of the following C statements...Ch. 2 - Given the equation y=ax3+7, which of the...Ch. 2 - State the order of evaluation of the operators in...Ch. 2 - (Arithmetic) Write a program that asks the user to...
Ch. 2 - (Printing Values with print!) Write a program that...Ch. 2 - (Comparing Integers) Write a program that asks the...Ch. 2 - (Arithmetic, Largest Value and Smallest Value)...Ch. 2 - (Diameter, Circumference and Area of a Circle)...Ch. 2 - Prob. 2.21ECh. 2 - What does the following code print? printf( *\n) ;Ch. 2 - (Largest and Smallest Integers) Write a program...Ch. 2 - (Odd or Even) Write a program that reads an...Ch. 2 - Print your initials in block letters down the...Ch. 2 - (Multiples) Write a program that reads in two...Ch. 2 - (Checkerboard Pattern of Asterisks) Display the...Ch. 2 - Prob. 2.28ECh. 2 - (Integer Value of a Character) Heres a peek ahead....Ch. 2 - (Separating Digits in an Integer) Write a program...Ch. 2 - (Table of Squares and Cubes) Using only the...Ch. 2 - (Body Mass Index Calculator) We introduced the...Ch. 2 - Prob. 2.33MD
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
In Problems 1 through 10, find a function y=f(x) satisfying the given differential equation and the prescribed ...
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
In the following field declaration from the TicketMachine class private int price; does it matter which order t...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Would you select a decoder/driver with active-HIGH or active-LOW outputs to drive a common-cathode 7-segment LE...
Digital Fundamentals (11th Edition)
Are reflex actions (such as flinching from a hot stove) rational? Are they intelligent?
Artificial Intelligence: A Modern Approach
A byte is made up of eight a. CPUs b. addresses c. variables d. bits
Starting Out with Java: From Control Structures through Objects (6th Edition)
In Exercises 1 through 22, determine the output displayed in the text box or list box by the lines of code.
Introduction to Programming Using Visual Basic (10th 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
- (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(Slope of a line) Write a program that prompts the user to enter the coordinates of two points (x1, y1) and (x2, y2), and displays the slope of the line that connects the two points. The formula of the slope is (y2 - y1)/(x2 - x1).arrow_forward(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.…arrow_forward
- (Find the second lowest interger number) Write a program that prompts the user to enter a set of integer numbers, and finally displays the second lowest integer number in the set. To exit from the program enter -1.arrow_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(Display the day and remaining hours) Write a program that prompts the user to enter the day number of a week and hours passed, and displays the day and remain- ing hours. For example, if the user entered day number 1 and hours passed 20, the program should display Today is Sunday and Remaining Hours: 4. If the user entered day number 7 and hours passed 2, the program should display Today is Saturday and Remaining Hours 22.arrow_forward
- (Algebra: solve 2 * 2 linear equations) A linear equation can be solved using Cramer’s rule given in Programming Exercise 1.13. Write a program that prompts the user to enter a, b, c, d, e, and f and displays the result. If ad - bc is 0, report that “The equation has no solution.”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 maximum, minimum, and average as a floating-point number. Here is a sample run:Enter an integer, the input ends if it is 0: 1 2 -1 3 0The number of positives is 3The number of negatives is 1The maximum is 3.0The minimum is -1.0The average is 1.25arrow_forward(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
- (Algebra: solve 2 x 2 linear equations) You can use Cramer's rule to solve the following 2 x 2 system of linear equation: ax + by = e ed – bf af- ec ad - bc cx + dy = f ad – bc y = Write a program that prompts the user to enter a and f and display the result. If ad - bc is 0 b, c, d , e, , report that The equation has no solution.arrow_forward(Science: calculating energy) Write a program that calculates the energy needed to heat water from an initial temperature to a final temperature. Your program should prompt the user to enter the amount of water in kilograms and the initial and final temperatures of the water. The formula to compute the energy is Q = M * (finalTemperature – initialTemperature) * 4184 where M is the weight of water in kilograms, temperatures are in degrees Celsius, and energy Q is measured in joules.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
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Literals in Java Programming; Author: Sudhakar Atchala;https://www.youtube.com/watch?v=PuEU4S4B7JQ;License: Standard YouTube License, CC-BY
Type of literals in Python | Python Tutorial -6; Author: Lovejot Bhardwaj;https://www.youtube.com/watch?v=bwer3E9hj8Q;License: Standard Youtube License