Computer Science, asked by haritvmala76gmailcom, 1 year ago

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 o if the above equation is satisfied with given four numbers otherwise returns -1

Answers

Answered by sagarpandav
36
boolean satis(int a,int b,int c,int d)
{
       int temp=a+b+c;
       if(temp==d)
       {
              return 0;
       }
       return -1;
}
Answered by johnygatha
10

Answer:

public class Program {

static int satis ( int a , int b , int c , int d )

{

if ( (Math.pow(a,3) + Math.pow ( b,3) + Math.pow ( c,3 ) ) == Math.pow(d,3) )

return(0);

else

return(-1);

}

   public static void main(String[] args) {

   System.out.println(satis(1,2,3,4));

       

   }

   

}

Explanation:

output will be -1 for this program

Similar questions