Function summation

Source
pub fn summation(n: i32) -> i32
Expand description

Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0. Using Arithmetic Series Sum Formula - Carl Friedrich Gauss.

ยงExample

summation(8);
returns 36