ower Number is defined as a number greater than zero that Thus, the first few (i
ID: 3873954 • Letter: O
Question
ower Number is defined as a number greater than zero that Thus, the first few (in order) are: 4 (2A2) 8 (2A3) 9 (342) 16 (244, 4A2) 25 (5A2) 27 (3A3) 32 (2A5) 36 (6A2) 49 (7A2) 64 (246, 8 2) 81 (344, 9A2) 100 (10A2) A P can be expressed as XAY, where X and Y are integers greater than one This function takes an integer i and returns the (zero-indexed) ith power number. Some examples: getPowerNumber(0) -> 4 getPowerNumber(3) -> 16 getPowerNumber (8) -> 49 Inputs less than zero should be considered an errorExplanation / Answer
int getPowerNumber(int a)
{
for(int i=2,i<n;i++)
{
for(j=2;j<n;j++)
{
arr[i]=pow(i,j);
}
}
sort(arr);
}
In this program, I gave you an algorithm as in how to proceed with the function. You first have to mention the range which has to more than 0 and less than a certain number. Later when you are storing them in an array, you can remove the duplicate values and sort the array. And return the value of the given index number.