#3658

GCD of Odd and Even Sums

newbie · 135 · lc easy +13 · 84.8% accepted · 96 likes · top 96%

Description

Given an integer n, compute sumOdd (the sum of the first n positive odd numbers) and sumEven (the sum of the first n positive even numbers). Return their GCD.

Code

1
2
3