/* 
 * Author:     Wil Schrader
 * Date:       9/3/2009
 * Version:    1.0
 * Class:      CIT 131 / Fall 2009 
 *
 * Assignment: 1) Sum of Numbers
 *                Ask the user to input an integer.
 *                Print the sum of the numbers from 1 to n.
 */
#include <stdio.h>

/* Main Function */
int main( void )
{
   int n;
   int count = 1;
   int sum = 0;

   /* Ask the user for an integer */
   printf( "Enter an integer: " );
   scanf( "%d", &n );

   /* Loop from 1 to n, adding n to the sum */
   while ( count <= n ) {
      sum += count;
      count++;
   } /* End While */

   /* Print out the result */
   printf( "The sum of numbers from 1 to %d is %d\n", n, sum );

   return 0; /* Program ended successfully */

} /* End Main Function */
