From 26a793ac0ac4ba9fbaa432f230f3f7b0845689f7 Mon Sep 17 00:00:00 2001 From: KAUSHAL DEVRARI <71590645+KaushalDevrari@users.noreply.github.com> Date: Sun, 4 Oct 2020 12:51:21 +0530 Subject: [PATCH] Create linear_diophantine_eqn.m --- algorithms/maths/linear_diophantine_eqn.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 algorithms/maths/linear_diophantine_eqn.m diff --git a/algorithms/maths/linear_diophantine_eqn.m b/algorithms/maths/linear_diophantine_eqn.m new file mode 100644 index 0000000..68ed572 --- /dev/null +++ b/algorithms/maths/linear_diophantine_eqn.m @@ -0,0 +1,12 @@ +% Linear Diophantine Equation +%Given three integers a, b, c representing a linear equation of the form : ax + by = c. +%To find if the equation has a solution such that x and y are both integral values. +%Used in programming to find the exact solution exists or not. + +function retval = linear_diophantine_eqn (a,b,c) + if c % gcd(a,b)==0 + retval=true; % 1 represent yes it exist + else + retval= false; % 0 represent no it doesn't exist + +end