Setprecision for equation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Setprecision for equation

Is there a way I can setprecision for an equation? I'm using the discriminant formula and asking the user to input a number for a, b, and c for the equation d= b * b - 4 * a * c. I want it to setprecision to 2 decimal places but I don't how to for an equation.

9th Sep 2018, 3:25 AM
Krista Clark
Krista Clark - avatar
1 Answer
+ 1
Krista Clark you need to set precision i.e. round to few decimals for concerned variables.. please go through below code for reference: https://code.sololearn.com/cpaN4tJjP97N/?ref=app
9th Sep 2018, 6:37 AM
Ketan Lalcheta
Ketan Lalcheta - avatar