[정올] Language Coder_반복제어문1_자가진단4_code539 (C)

두비니

·

2020. 3. 14. 01:45

 

 

#include <stdio.h>

int main() {
	int a, sum = 0, num=0;
	float avg;

	while (1) {
		scanf("%d", &a);
		if (a < 100) {
			sum += a;
			num++;
		}
		else {
			sum += a;
			num++;
			avg = (float)sum / num;
			printf("%d\n", sum);
			printf("%.1f", avg);
			return 0;
		}
	}

}