Question: 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
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
Get step-by-step solutions from verified subject matter experts
