I'm very new to CS and programming and am trying to write a code for the cs cash problem set 1.I don't think this is the intended solution and I know this isn't a clean and condensed code, but at this point I'm just trying to make it run.I was wondering if the code I wrote was complete gibberish or if it could actually work because it honestly made sense to me theoretically.
#include<stdio.h>
#include<cs50.h>
#include<math.h>
int main(void)
{
float change;
do
{
change= get_float("Enter change here\n");
}
while(change<0);
int quarter=floor(change/0.25);
int dime=floor((change-(quarter*0.25))/0.10);
int nickel=floor((change-(quarter*0.25)-(dime*0.10))/0.05);
int penny=round((change-(quarter*0.25)-(dime*0.10)-(nickel*0.05))/0.01);
int sum =quarter+nickel+dime+penny;
printf("%i",sum);
}