Skip to content

Quadratic discriminant

C# if / else if / else

Flowchart (ISO 5807)

YesNoYesNoStartInput a, b, cd = b² − 4acd > 0Output «два корені»d = 0Output «один корінь»Output «немає коренів»EndFigure 1 — Program.SolveQuadratic

Source code

C#
class Program {
    static void SolveQuadratic(double a, double b, double c) {
        double d = b * b - 4 * a * c;
        if (d > 0) {
            System.Console.WriteLine("два корені");
        } else if (d == 0) {
            System.Console.WriteLine("один корінь");
        } else {
            System.Console.WriteLine("немає коренів");
        }
    }
}

The editor opens with this code — change it and the chart redraws.

Language
C#
Constructs
if / else if / else
Topic
Branching
Formats
Word, Visio, draw.io, PDF, SVG

Related examples