Aim : Write a function power() that takes a double value n and an int p, returning n raised to p. Use a default value of 2 for p to square n if omitted. Create a main() function to get user input and test power().

Theory Functions (Methods):
A function is a set of statements that takes input, does some specific computation, and produces output. The idea is to put some commonly or repeatedly done tasks together to make a function so that instead of writing the same code again and again for different inputs, we can call this function. In simple terms, a function is a block of code that runs only when it is called. .
Syntax:
return_type function_name(parameter_list) {
// function body
return return_value;
}
Program :

Conclusion : Hence we have performed our practical successfully