/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
#include <stdarg.h>
#include <stdio.h>
#include "sum1.h"

double sum1(int count, ...) {
  int i;
  double  retval = 0, d1;
  va_list ap;

  va_start(ap, count);
  if(count < 0) {
    printf("Wrong number of argument\n");
    exit(-1);
  } 
  for(i = 0; i < count; i++) {
    d1 = va_arg(ap, double);
    retval += d1;
  }

  return retval;
}
