Advertisement
Guest User

Untitled

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