#include <stdio.h>
// 프로토타입: 함수를 실제로 정의하기 전에 컴파일러에게 미리 알려주는 선언
// 반환자료형 함수이름(매개변수 자료형, 매개변수 자료형);
#define MAX_SIZE 100
float sum(float [], int);
float input[MAX_SIZE], answer;
void main(void) {
int i;
for(i=0; i<MAX_SIZE; i++){
input[i] = i;
answer = sum(input, MAX_SIZE);
printf("The sum is %f \n", answer );
}
// return 0;
}
float sum(float list[], int n){
int i;
float tempsum = 0;
for(i=0; i<n; i++){
tempsum+= list[i]; //0~99까지의 합
}
return tempsum;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: