Java Bài 8.A1: Tính tổng 1(Đệ Quy).


LÀM BÀI

Points: 10 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Tính tổng hàm S(n) = 1 + 2 + 3 + 4 + .. + n bằng đệ quy. Nếu bạn chưa biết thì S(n) có thể tính nhanh bằng công thức S(n) = n * (n + 1) / 2.

Input Format

Số nguyên dương n.(0≤n≤1000)

Constraints

.

Output Format

In ra S(n).

Ví dụ:

Dữ liệu vào
100
Dữ liệu ra
5050

Comments

There are no comments at the moment.

Zalo