+ 1

Write a C++ programme to find out the sum of given n numbers.(using for loop)

3rd Sep 2016, 3:38 AM
Raj Bhavsar
Raj Bhavsar - avatar
1 Resposta
0
//returns 1+2+...+n int sumTo(int n) { return (n * (n + 1)) / 2; }
3rd Sep 2016, 5:15 AM
Zen
Zen - avatar