while
int sum(int n) { int result = 0, counter= 1; while(counter<=n) { result = result+counter; counter= counter+1; } return result; }