% Mark Carrara Math 375 Assignment 1
% Roots of a Quadratic
% Ax^2+Bx+C=0

disp('     ')
disp('Solve Ax^2+Bx+C=0') 
for    A=input('What is A=');			%Input coefficient A
       B=input('What is B=');			%Input coefficient B
       C=input('What is C=');			%Input coefficient C
       
  
if  abs(C);					%If C is true=>non-zero positive
    
 if abs(A);					%If A is true=>non-zero positive
     a=A/A;
     b=B/A;
     c=C/A;

    
     if (b/2)^2 >= c;				%Real Roots
         disp('     ')
	 disp('roots=')
	 x1=(-b/2)+sqrt((b/2)^2-c);
         x2=(c/x1);				%
         disp(x1)
	 disp(x2)
     else
   	 x1=(-b/2)-sqrt(abs((b/2)^2-c))*i;	%Imaginary Roots
  	 roots=(c/(-x1))*i^2			%
	 disp(x1)
	       
     end
 else
	  disp('     ')
	  disp('x1=x2=')
	  x=(-C/B);				%Linear Root for A=0
 	  disp('     ')
	  disp(x); 
 end 

	for     a=4/3;				%Matlab unit roundoff
		b=a-1;
		c=b+b+b;
		U=abs(c-1);
		disp('Unit Roundoff (Matlab)=')	
		disp(U)
	end	

else						%If C=0, Ax^2+Bx=0
 x1=0
 x2=(-B/A) 
		
end
end 
end
