float를 쓸 때 프로그램은 이렇습니다:
#include <stdio.h>
int main() {
float result;
float input;
scanf("%f", &input);
result = input / .25;
printf("%f", result);
return 0;
}
값으로 3을 입력하면 12.000이 출력됩니다. 그런데 float를 double로 바꾸면 항상 0.000이 나옵니다. 제가 뭘 놓치고 있나요?
영어에서 번역·원문 보기With float my program looks like this:
#include <stdio.h>
int main() {
float result;
float input;
scanf("%f", &input);
result = input / .25;
printf("%f", result);
return 0;
}
Entering the value 3 produces 12.000 as output. Replacing float with double, however, consistently gives me 0.000 instead. Is there something I'm overlooking here?