Advertisement
Guest User

sum of cube of n natural numbers

a guest
Sep 30th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.10 KB | None | 0 0
  1. cubeSum(1,1).
  2. cubeSum(N,S):-
  3.     N > 1,
  4.     N1 is N-1,
  5.     cubeSum(N1,S1),
  6.     S is N*N*N + S1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement