Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. public static double recRaiseHalf(double x, int k) {
  2. if(k == 0) {
  3. return 1;
  4. }
  5. double y = recRaiseHalf(x, k/2);
  6.  
  7. if(k % 2 == 0) {
  8. System.out.println("K is even " + k);
  9. return y * y;
  10. }
  11. else {
  12. System.out.println("K is not even " + k);
  13. return x * y* y;
  14. }
  15. }
  16. public static void main(String[] args) {
  17. System.out.println(recRaiseHalf(4,4));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement