Anche nella scanf devi usare %lf

scanf("%lf", &x);