Lalala
Lalala
Assignme
Name:
nt
Prog.1: Write a complete Java program that invokes a
function satis() to find whether four integers a, b, c, d
sent to satis( ) satisfy the equation a3 + b3 + c3 = d3 or
not. The function satis( ) returns 0 if the above equation
is satisfied with the given four numbers otherwise it
returns -1.
import java.util.Scanner;
class CheckEqn
{
int satis(int p,
int q,
int r,
int s) {
int res;
if(lhs == rhs)
res = 0;
else
res = -1;
return res;
}
if(res == 0)
System.out.println("Equation satisfied");
else
System.out.println("Equation not satisfied");
}
}