QUESTION: MY CODE BELOW IS NOT GIVING ME THE VALUE OF "i" in the proper format. First it would give me a value of 0. I made some changes. Now, when asked "How much change is owed?" If the input is .45 then the output that comes back is 45.
CODE:
#include <cs50.h>
#include <stdio.h>
#include <math.h>
int q = 25;
int d = 10;
int n = 05;
int p = 01;
int main(void)
{
float f;
do
{
printf("Hi. How much change is owed?\n");
f = GetFloat();
}
while (f <= 0);
int i = f * 100; //I TOOK AWAY THE * 100 BUT THEN THE OUTPUT BECOMES 0//
printf("%i", i);
TERMINAL:
Hi. How much change is owed?
.45
45