摘要:
1. sum(3) => 6; sum(1,3) => 6; sum(6,6) => 6;sum(N) when is_integer(N) -> sum_acc(N,0);sum(_) -> {error, {bad_argument}}.sum_acc(0, Sum) -> Sum;sum_acc(N, Sum) -> sum_acc(N-1, Sum + N).sum(N, M) when is_integer(N), is_integer(M), M >= N -> sum_acc3(N, M, 0);sum(_, _) -> 阅读全文
posted @ 2013-06-29 21:35 bobolive 阅读(225) 评论(0) 推荐(0) 编辑