Scanf for double not working in Dev C++

后端 未结 4 1550
忘掉有多难
忘掉有多难 2021-01-27 11:51

I am having problem with floating point numbers. I think something is clashing here.

The output is :

\"Scre

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-27 12:13

    Use

    scanf("%lf", &y);
    

    instead. Since scanf("%f", &y); works for floats only.

    If you enable compiler warnings it would tell you that the format specifier "%f" expects a float * and not double * argument.

提交回复
热议问题