c언어 코딩 문제 도와주세요ㅜ

익명 사용자의 이미지

실수를 전달받아 소수 첫째 자리에서 반올림한 정수값을 리턴하는 round() 함수를 정의하시오. round() 함
수를 이용하여 다음과 같이 0.0이 입력될 때까지 반올림을 계산하여 출력해주는 프로그램을 작성하시오.

int main() {
double num;

printf("실수 입력 (0.0 입력시 종료): ")
scanf(" %lf",

}

더 이상 진도를 못 나가겠습니다...
도와주세요ㅜㅜ

익명 사용자의 이미지

뭐 대충 이렇게 짜면 되겠네요.

#include <stdio.h>
#include <math.h>
 
static _Bool get_input(double *input);
 
int main(){
	double input;
	while(get_input(&input)) printf("%f\n", round(input));
 
	return 0;
}
 
_Bool get_input(double *input){
	printf("실수 입력 (0.0 입력시 종료): ");
 
	return scanf("%lf", input) == 1 && *input;
}