#include<stdio.h>


int main(void)

{

double operand,total;

int count,retry,for_retry;


count=retry=total=for_retry=0;


printf("ttt 평균 구하기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("nnnnn다시 하시겠습니까? 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;

}