Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace TestConsole.Mathematic
- {
- public class QuadricFunctionCalculator
- {
- public List<double> GetResults(double a, double b, double c)
- {
- double delta = Math.Pow(b,2) - (4 * a * c);
- if (delta > 0)
- {
- double p1 = (-b - System.Math.Sqrt(delta)) / (2 * a);
- double p2 = (-b + System.Math.Sqrt(delta)) / (2 * a);
- return new List<double> { p1, p2 };
- }
- else if (delta == 0)
- {
- double p0 = (-b) / (2 * a);
- return new List<double> { p0 };
- }
- return new List<double> { };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement