I have to make a table that takes two integers called int a and int b suppose int a is 5 and int b is 1 then I have to add, subtract,divide, get the remainder and then taking the first number to the power of the second number without using a Java library method like pow. The input values should be seperated by a single tab
character, as should the output value If I first add these numbers I will get 6 then subtract to give 4 multiply to give 5 and divide to give 5 then take the remainder to get 0 and
then take the power of the first number to the power of the second number to get 5.
Here is how the table should look
5 1 6 4 5 5 0 5
I have started doing the code and it does fine but the problem is I do not know how to take the first number to the power of the second number and display it in the table
without using a Java Library method like pow
Here is what I did so far for the display part of this program it is almost complete just the last part
System.out.println(a + "\t" + b + "\t" + (a+b) + "\t" + (a-b) + "\t" + (a*b) + "\t" + (a/b)+ "\t" + (a%b));
I need a loop to be made to display the first number to the power of the second number and then take a result and display it in the sop code. If anyone knows how to do it please show how this loop should look and take that result to the sop code.
Thank You everyone for the help