:-object sum.

main :- sum(100, S),
             format('the sum from 1 to 100 is ~w~n', [S]).

sum(1,1).

sum(N,S):- N1 is N-1,
	     sum(N1,S1),
	     S is S1+N.

:-end_object sum.