;double型输入要用%lf格式,不能用%f格式
scanf("%f",&w)改成scanf("%lf",&w)输入double类型数据,需要用%lf
scanf("%lf",&w);
double型要用%lf
double是双精度浮点数,在输入输出时必须用%lf的格式