Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C for engineers, using code blocks In first 2 exercises I need to create the table shown 2 of 3 Chapter 05a Program Exercises PE

image text in transcribed
image text in transcribed
C for engineers, using code blocks
In first 2 exercises I need to create the table shown
2 of 3 Chapter 05a Program Exercises PE 05a GRounding w Integers The function floor from the enath-ho standard libeary can be used to round a floating point numberto the nearest integer with the following floor x e-S Convert the above statement into your own function thatrounds afloating-point numberto the nearest integer. Your function must receivea double data type as the argument and retum an int data type. Test your function with a for loopthat varies the control variable from 0.1 to 10in ts of 0A27. Print the loop couw, original wwwher, and rounded in a tabular format to the screen. Your program should include a title for the table, A sample output is illustrated below. 2.235000 2.662aaa 3.089000 3.516aaa 3.943000 12 4.79 7aee 15 6.e78aae 16 6-sesaae 6-932000 7.359000 19 8.213aaa 8.64aaaa 9.067aang Chapter 05a Program Exercises PE 05a 02 (Rounding Me Decimals) Rounding foating point numbers to a specific decimal place using the floor function can be accomplished by scaling the function by 10 or l00 to round to the nearest tenths or hundred hr, respectively. The statements below demonstrate how the floor function can be scaled lo perfom each rounding operation. floor 10 e 5) rounds to tenths. 100.03 rounds to hundredths

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions