Advertisement
Guest User

sum of square of n natural numbers

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