Skip to content

Commit 69ae666

Browse files
authored
Merge pull request #64 from KaushalDevrari/patch-3
Create linear_diophantine_eqn.m
2 parents f03f5d1 + 26a793a commit 69ae666

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
% Linear Diophantine Equation
2+
%Given three integers a, b, c representing a linear equation of the form : ax + by = c.
3+
%To find if the equation has a solution such that x and y are both integral values.
4+
%Used in programming to find the exact solution exists or not.
5+
6+
function retval = linear_diophantine_eqn (a,b,c)
7+
if c % gcd(a,b)==0
8+
retval=true; % 1 represent yes it exist
9+
else
10+
retval= false; % 0 represent no it doesn't exist
11+
12+
end

0 commit comments

Comments
 (0)