Check out example codes for "c++ scanf always expects double and not float". It will help you in understanding the concepts better.

Code Example 1

float max, zz, rate, time, percent;

printf("Please enter the size (in GB): ");
scanf_s("%f", &max);

printf("\nPlease enter how much you have downloaded already (in GB): ");
scanf_s("%f", &zz);

printf("\nPlease enter the downloadrate (in kB/s): ");
scanf_s("%f", &rate);

Learn ReactJs, React Native from akashmittal.com