/* CSE 333 Su12 Lecture 3 demo: sum_betterorder.c */
/* Gribble/Perkins */

/* Function declaration order: one way to declare a function is */
/* to give its full definition. */

#include <stdio.h>

// Return sum of integers from 1 to max
int sumTo(int max) {
  int i, sum = 0;
  
  for (i=1; i<=max; i++) {
    sum += i;
  }
  return sum;
}

int main(int argc, char **argv) {
  printf("sumTo(5) is: %d\n", sumTo(5));
  return 0;
}