Question

Write the definition of a function that takes as input the three numbers. The function returns...

Write the definition of a function that takes as input the three numbers. The function returns turn if the first number to the power of the second number equals the third number otherwise it returns false. Assume that the three numbers are of type double. Use paw() function for the power.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.Scanner;


public class TestPow {

public static boolean paw()
{
   boolean result=false;
    Scanner scan=new Scanner(System.in);

    System.out.println("Enter a value: ");
    double a=scan.nextDouble();
    System.out.println("Enter b value: ");
    double b=scan.nextDouble();
    System.out.println("Enter c value: ");
    double c=scan.nextDouble();
  
  
    double power=Math.pow(b,a);
      
    if(power==c)
    {
       result=true;
    }
  
  
     return result;
}
    public static void main(String[] args) {
         boolean result=paw();
         System.out.println("The result is::::: "+result);
       
       
   }

}

output:

Enter a value:
2
Enter b value:
4
Enter c value:
16
The result is::::: true

Add a comment
Know the answer?
Add Answer to:
Write the definition of a function that takes as input the three numbers. The function returns...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT