#include<stdio.h>


int main(void)

{

double operand,total;

int count,retry,for_retry;


count=retry=total=for_retry=0;


printf("\t\t\t 평균 구하기\n");

do

{


for(;for_retry==0;)

{


printf("%d 번째의 값을 입력해 주십시오(minus to quit)\n",count+1);

scanf("%lf",&operand);


if(operand>0)

{

total+=operand;

count++;

for_retry=0;

}

else if(operand<0)

for_retry=1;


}


printf("%d개의 숫자의 평균값은 %lf 입니다.\n",count,total/count);


printf("\n\n\n\n\n다시 하시겠습니까? \n1.네\2.아니오\n");

scanf("%d",&for_retry);


if(for_retry==1)

{

for_retry=--for_retry;

total=count=0;

}

else if(for_retry==2)

for_retry=--for_retry;

else

printf("잘못된 번호입니다. 그러므로 종료합니다\n");

}while(for_retry==0);


return 0;

}










-값 받으면 평균구하게되있는데

stop 이라던가 s 만쳐도 평균값 구하는걸 아직 안배워서 ㅠㅠ