#include <stdio.h> 

double centi_to_meter(int cm);

int main(void)
{
    double res;

        res = centi_to_meter(187);
        printf("%.2lfm\n", res);

        return 0;
        
}

double centi_to_meter(int cm) // 함수 선성, 정의할 때는 항상 함수의 반환형을 함수명 앞에 명시해줘야 한다!!! -> 안 해서 틀림
{
    double res;

    res = cm / 100.0; // res는 더블형인데 100으로 나눠 버리면 나누 제수와 피제수 모두 인트형이므로 오류발생. 100.0 으로 바꾸면 실수와 정수의 연산은 정수의 패배!

    return res;

    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: