#include <stdio.h>
int main() {
double x = 10.4, y;
int m = 2;
y = x/m;
printf("%.1f\n", y);//5.2
printf("%.1f\n", (double)(7/2)); //3.0, why not 3.5 ?
printf("%.1f\n", 3.5f);//3.5
// the last line prints 3.5,
// why its not rounding down to 3.0 ,as it did above ?
}
ここで何が起きているのか説明できる人はいますか?ラインprintf("%.1f\n", (double)(7/2));
でCダブルフォーマッタのプレースホルダーの理解
@LưuVĩnhPhúc私もその1つを見て、感謝! –