function plotQuadratic(a, b, c)
close all;
x0 = -5;
xf = 5;
x = [x0 : 0.1 : xf];
y = a*x.^2 + b*x + c;
plot(x,y);
grid on;
hold on;

[x1 x2 flag] = solveQuadratic(a, b, c);
if flag == 0
    plotRoots(x1, x2);
end

function [x1 x2 flag] = solveQuadratic(a, b, c)
flag = 0;
D = b^2 - 4*a*c;
if D < 0
  flag = 1;
end 
x1 = (-b+sqrt(D))/(2*a);
x2 = (-b-sqrt(D))/(2*a);

function plotRoots(x1, x2)
plot(x1,0, 'o');
plot(x2,0, 'o');

