We know that p number is being used in many types of calculation like to calcula
ID: 3641254 • Letter: W
Question
We know that p number is being used in many types of calculation like to calculate the area of a disc. We use this number with an approximation of 3 to 6 significant numbers. (eg. 3.14 as a 3 significant numbers approximation)One simple formula for approximate the value of p is dividing 355 by 113. Write a SELECT statement that computes p with 3, 4 and 5 significant numbers using this dividing technique.
Automatic Data type conversions
Be aware that some DBMS behave differently regarding automatic data type conversions. In PostgreSQL, where this will be tested on, a division of two Integer values yields an Integer result too, ignoring a remainder: 2/3 = 0
If you want to have explicit real results, you need to supply real input values: 2.0 / 3.0 = 0.66667
Selected output should print:
3.14|3.141|3.1415
Explanation / Answer
For MSSQL:
SELECT round(355.0/113.0, 2, 1) , round(355.0/113.0, 3, 1) , round(355.0/113.0, 4, 1) ;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.