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
Question
Chapter 4, Problem 39PS
Program Plan Intro
To create a function to compute the perimeter and area of a triangle.
Program Plan:
The program should be written in C
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Complete the function that calculates the sum of the first n+1 terms of the geometric series
a, ar, ar² ar³, art
Note that the series begins with a and the last term is ar", in total there are n+1 terms.
# complete the function given the variables a,r,n and return the value as series_sum.
def sum geometric_series (a,r,n):
# YOUR CODE HERE
return series_sum
... arr
print (sum_geometric_series (4.0, 5, 10))
Rainfall is typically measured using a rain gauge. It is expressed as the depth of water that collects on a flat
surface, and is routinely measured hourly in millimetre.
Write function to return the heaviest rainfall within that week.
Complete the function that calculates the sum of the first
n+1 terms of the geometric series
a, ar, ar² ar³, arª ….. arn
Note that the series begins with a and the last term is ar",
in total there are n+1 terms.
1: # complete the function given the
#variables a,r,n and return the value as series_sum.
def sum geometric_series(a,r,n):
# YOUR CODE HERE
return series_sum
print (sum_geometric_series (4.0, 5, 10))
Chapter 4 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
Ch. 4 - Prob. 1PSCh. 4 - The function definition contains the code for a...Ch. 4 - Function calls that return void may not be used as...Ch. 4 - The address operator (&) is used to tell the...Ch. 4 - Variables defined within a block have global...Ch. 4 - Prob. 6PSCh. 4 - Which of the following statements about function...Ch. 4 - Which of the following is not a part of a function...Ch. 4 - Which of the following statements about function...Ch. 4 - Which of the following statements about local...
Ch. 4 - Prob. 11PSCh. 4 - Prob. 12PSCh. 4 - Which of the following statements will generate a...Ch. 4 - Which of the following statements about structure...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function calls:...Ch. 4 - Evaluate the value of the following expressions:...Ch. 4 - Evaluate the value of the following...Ch. 4 - Prob. 23PSCh. 4 - Define the range of the random numbers generated...Ch. 4 - What would be printed from Program 4-17 when run...Ch. 4 - Prob. 26PSCh. 4 - Prob. 27PSCh. 4 - Prob. 28PSCh. 4 - Prob. 29PSCh. 4 - Write a program that generates a random number...Ch. 4 - Prob. 31PSCh. 4 - Code and run Program 4-16, "Top—down Development...Ch. 4 - Prob. 33PSCh. 4 - Prob. 34PSCh. 4 - Expand the calculator program, Program 4-15, to...Ch. 4 - Prob. 36PSCh. 4 - Write a function that receives a positive...Ch. 4 - Prob. 38PSCh. 4 - Prob. 39PSCh. 4 - Prepare a payroll earnings statement for the sales...Ch. 4 - Write a program that, given a beginning balance in...Ch. 4 - The formula for converting centigrade temperatures...Ch. 4 - Write a program that uses standard functions. The...Ch. 4 - Write a C program that creates customers' bills...
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
- (Statics) A beam’s second moment of inertia, also known as its area moment of inertia, is used to determine its resistance to bending and deflection. For a rectangular beam (see Figure 6.6), the second moment of inertia is given by this formula: Ibh3/12 I is the second moment of inertia (m4). b is the base (m). h is the height (m). a. Using this formula, write a function called beamMoment() that accepts two double- precision numbers as parameters (one for the base and one for the height), calculates the corresponding second moment of inertia, and displays the result. b. Include the function written in Exercise 4a in a working program. Make sure your function is called from main(). Test the function by passing various data to it.arrow_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_forwardThe code is not printing the correct result. Please explain to me step by step.arrow_forward
- This procedure is called as interpolation because it entails guessing a function's value at a location outside the data's range.arrow_forwardpythonarrow_forwardQ.1: Given the definite integral 4 y = f(x) = dx 1 a. Use MATLAB's symbolic int function to obtain the value of this integral b. Obtain the value of this integral with the q = quad('f(x)', a, b) function %3D c. Obtain the value of this integral with the q = quad('f(x)', a, b, tol) function where tol = 10-9 %3Darrow_forward
- The following formula can be used to determine the surface area of a cylinder: A-2*pi'r*h+2"pir ris the radius of the cylinder and h is the height of the cylinder. Write a Python function named cylinder that accepts the radius and height as arguments. The function should return the area of the cylinder. Only write the function.arrow_forwardDo not use numpy module or any other module. language:PYTHONarrow_forward% WRITE CODE BELOW: % Step 1: Write a function called "collatz" below where you take an input % n, and if n is odd, return 3*n+1. If n is even, return n/2. (You need to % compute mod (n, 2) to test for even/odd. If mod(n,2)==1, n is odd, % otherwise n is even) Matlab codearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author: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
Python - bracket parenthesis and braces; Author: MicroNG;https://www.youtube.com/watch?v=X5b7CtABvrk;License: Standard Youtube License