0 0 Berlin Asked: November 19, 20212021-11-19T12:21:25+05:30 2021-11-19T12:21:25+05:30In: Programming Language Write a program to print the power of 7 raised to 5. 0 0 Write a program to print the power of 7 raised to 5. Share Facebook 1 Answer Voted Oldest Recent JonSnow07 2021-11-19T17:58:29+05:30Added an answer on November 19, 2021 at 5:58 pm // Java program to find the power of a number class GFG { // Function to calculate N raised to the power P static int power(int N, int P) { if (P == 0) return 1; else return N * power(N, P – 1); } // Driver code public static void main(String[] args) { int N = 7; int P = 5; System.out.println(power(N, P)); } } OUTPUT is in attachment. Attachment Leave an answerCancel replyYou must login to add an answer. Username or email* Password* Remember Me! Forgot Password?
// Java program to find the power of a number
class GFG {
// Function to calculate N raised to the power P
static int power(int N, int P)
{
if (P == 0)
return 1;
else
return N * power(N, P – 1);
}
// Driver code
public static void main(String[] args)
{
int N = 7;
int P = 5;
System.out.println(power(N, P));
}
}
OUTPUT is in attachment.