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.
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 3, Problem 29PS
Program Plan Intro
To write a program that asks for a number and prints the digit’s second rightmost value of float’s integral portion.
Program Plan:
Create a code that reads the float number from the user.
The code should display the second rightmost digit of the float.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Take a float input from the user and type cast it to int and print it on the screen.
Write the following function to draw a regular polygon:def drawPolygon(x = 0, y = 0, radius = 50, numberOfSides = 3):The polygon is centered at (x, y) with a specified radius for the bounding circle for the polygon and the number of sides. Write a test program that displays a triangle, square, pentagon, hexagon, heptagon, and octagon, as shown in Figure 6.12a.
/(8).
Chapter 3 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
Ch. 3 - A unary expression consists of only one operand...Ch. 3 - The left operand in an assignment expression must...Ch. 3 - Associativity is used to determine which of...Ch. 3 - Side effect is an action that results from the...Ch. 3 - Prob. 5PSCh. 3 - Prob. 6PSCh. 3 - Prob. 7PSCh. 3 - Prob. 8PSCh. 3 - Prob. 9PSCh. 3 - Prob. 10PS
Ch. 3 - Which of the following statements about mixed...Ch. 3 - Which of the following statements about compound...Ch. 3 - Prob. 13PSCh. 3 - Prob. 14PSCh. 3 - Which of the following is not a binary expression?...Ch. 3 - Prob. 16PSCh. 3 - If originally x=4, what is the value of x after...Ch. 3 - Prob. 18PSCh. 3 - Prob. 19PSCh. 3 - What is the value of each of the following...Ch. 3 - Given the following definitions, which of the...Ch. 3 - If originally x=2,y=3,andz=2, what is the value of...Ch. 3 - Prob. 23PSCh. 3 - If x=2945, what is the value of each of the...Ch. 3 - Prob. 25PSCh. 3 - Prob. 26PSCh. 3 - Write a program that reads two integers from the...Ch. 3 - Write a program that extracts and prints the...Ch. 3 - Prob. 29PSCh. 3 - Write a program that calculates the area and...Ch. 3 - Prob. 31PSCh. 3 - Prob. 32PSCh. 3 - Write a program that changes a temperature reading...Ch. 3 - Write the C code for each of the following...Ch. 3 - Prob. 35PSCh. 3 - Write a program that converts and prints a...Ch. 3 - Prob. 37PSCh. 3 - Write a program that prompts a user for an integer...Ch. 3 - Prob. 39PS
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
- 6. Write a program which reads string and rewrite it in alphabetical order. For example, the word STRING should be written as GINRST. 7. Write a program to replace a particular word by another word in a given string. For example the “PYTHON” should be replaced by “C” in the text “It is good to program in PYTHON language”. 8. Write a program that will find the maximum number from 3 float type numbers. You have to usethe function getMax which will take 3 pointer variables and return the maximum number.arrow_forward[Python Language] A common back-of-the-envelope technique for estimating a runner’s marathon time is to take their best half-marathon time, multiply by two and add ten minutes. This works pretty well unless the marathon course is hilly.If it is hilly, we add an extra 20 minutes to the estimate. Write a program that takes two lines of input: a float giving the half- marathon time in minutes and an integer indicating whether the marathon course is hilly(1) or not (0). It prints a float giving the estimated number of minutes the runner will take to run the full marathon. Write your pro- gram in a file named marathon.py.arrow_forwardAssuming that you have the functions "drawPolygon(int[] x, int[] y, int n)" for drawing polygon, "drawRectangle(int x, int y, int width, int height)" for drawing rectangle and "drawCircle(int xc, intyc, int radius)" for drawing circle; draw the given shape. Where: R(300,250), T1(325,275), T2(475,275), T3(400,400), Pı(285.250), P2(225.275), P3(200,450), P4(285, 300), Q1(515,250), Q2(575,275), Q3(600,450), Q4(515,300) C6: (300,75), R=50 C7: (500,75), R=50 C1: (400,150), R=100 С4: (350,150), R-10 C5: (450,150), R=10 C2: (400,195), R=50 C3: (400,175), R=30 C8: (400,225), R=15 P1 R P2, T2 P4 Q2 Q4 T3 Pa 200arrow_forward
- (Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?arrow_forward(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.arrow_forwardpython programming Write a function find_hypot which, given the length of two sides of a right-angledtriangle, returns the length of the hypotenuse. (Hint: x ** 0.5 will return the squareroot.)arrow_forward
- Write code that outputs variable numItems.arrow_forwardConsider records of employees each consists of employee's first name (string), number of hours worked (int)and hourly rate in Bahraini Dinar BD. (double).Write a program that reads from the user multiple records for multiple employees and displays the following onscreen:(a) the salary for each employee (Salary = Hours Worked x Hourly rate.)(b) the number of employees(c) the highest salary with employee name.Reading records of employees should stop when the user enter `stop' for the employee name. Sample I/O of theprogram is shown in the example below.arrow_forwardWrite a C++ program that simulates online shopping. Declare a variable cart to be an empty Array. The program should have a loop that continues as long as the user wants to shop. Each time through the loop read in the name, price, and quantity of the item the user wants to add to the cart. After adding an item to the cart, the cart contents should be printed. After the loop print a "Please pay ...” message with the total price of the items in the cart.arrow_forward
- This program is meant to help you get practice with writing programs to perform more complex numerical calculations, and specifically to give you practice with vector calculations. Write a program that calculates the angle between two points, as seen by an observer. Your program should read in: The 3D position of an observer The 3D position of the first observed point The 3D position of the second observed point Then, it should calculate and output, in degrees, the angle between the points from the viewer’s perspective. The steps for doing this are: Read in the points from the user. Assume the points will be some (x, y, z) coordinates. Calculate the two vectors from the observer to each of the observed points Normalize the vectors Calculate the dot product between the vectors Use that to calculate the angle between the two observed points. Note that the dot product of two normalized vectors gives the cosine of the angle between those vectors. Outputs the answer in degrees…arrow_forwardC++arrow_forwardc programararrow_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 LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
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