Skip to content

Commit 5122cae

Browse files
authored
Merge pull request #68 from Abhishek-photon/patch-1
Create shreeDharacharyaFormula.m
2 parents e9530c9 + ae07f87 commit 5122cae

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
%% Shree Dharacharya Formula
2+
% aX^2 + bX + c = 0
3+
function [x1,x2] = shreeDharacharyaFormula(a,b,c)
4+
% calculates the roots of a quadratic equation.
5+
d = b^2 - 4*a*c;
6+
7+
if d < 0
8+
disp('Imaginary roots');
9+
10+
else
11+
x1 = (-b + d^(1/2))/(2*a);
12+
13+
x2 = (-b - d^(1/2))/(2*a);
14+
end
15+
16+
end

0 commit comments

Comments
 (0)