#include float GetAve(int *); main () { int mark[]={87,76,45,73,66,-1};
int i; float ave; ave=GetAve(mark); printf("配列:"); for(i=0;mark[i]>=0;i++){ printf("%d,",mark[i]); } printf("\nのへ基金地は%5.2f点です。\n",ave); } float GetAve (int *pva1) { int count=0; float average; for(average=0.0;*pva1>=0;pva1++){ average+=*pva1; count++; } average/=count; return average; }
|