#include <stdio.h>
void print_line(int index, int cents, int value)
{
float count = (float)cents / (float)value;
float dollar_part = (float)value / 100;
float cents_part = (float) value % 100;
printf("| %-2d | %9f.%02f | %5f |\n", index, dollar_part, cents_part, count);
}
void coins(int cents)
{
printf("You did not type in the correct format in terms of dollars and cents.\n");
printf("\n+----+--------------+-------+\n");
printf("| # | Denomination | Count |\n");
printf("+----+--------------+-------+\n");
print_line(1, cents, 10000);
cents = cents % 10000;
print_line(2, cents, 5000);
cents = cents % 5000;
print_line(3, cents, 1000);
cents = cents % 1000;
print_line(4, cents, 500);
cents = cents % 500;
print_line(5, cents, 200);
cents = cents % 200;
print_line(6, cents, 100);
cents = cents % 100;
print_line(7, cents, 50);
cents = cents % 50;
print_line(8, cents, 20);
cents = cents % 20;
print_line(9, cents, 10);
cents = cents % 10;
print_line(10,cents, 5);
cents = cents % 5;
print_line(11, cents, 1);
cents = cents % 1;
printf("+----+--------------+-------+\n");
printf("\n+----+--------------+-------+\n");
printf("| # | Denomination | Count |\n");
printf("+----+--------------+-------+\n");
print_line(1, cents, 10000);
cents = cents % 10000;
print_line(2, cents, 5000);
cents = cents % 5000;
print_line(3, cents, 1000);
cents = cents % 1000;
print_line(4, cents, 500);
cents = cents % 500;
print_line(5, cents, 200);
cents = cents % 200;
print_line(6, cents, 100);
cents = cents % 100;
print_line(7, cents, 50);
cents = cents % 50;
print_line(8, cents, 20);
cents = cents % 20;
print_line(9, cents, 10);
cents = cents % 10;
print_line(10,cents, 5);
cents = cents % 5;
print_line(11, cents, 1);
cents = cents % 1;
printf("+----+--------------+-------+\n");
printf("\n+----+--------------+-------+\n");
printf("| # | Denomination | Count |\n");
printf("+----+--------------+-------+\n");
print_line(1, cents, 10000);
cents = cents % 10000;
print_line(2, cents, 5000);
cents = cents % 5000;
print_line(3, cents, 1000);
cents = cents % 1000;
print_line(4, cents, 500);
cents = cents % 500;
print_line(5, cents, 200);
cents = cents % 200;
print_line(6, cents, 100);
cents = cents % 100;
print_line(7, cents, 50);
cents = cents % 50;
print_line(8, cents, 20);
cents = cents % 20;
print_line(9, cents, 10);
cents = cents % 10;
print_line(10,cents, 5);
cents = cents % 5;
print_line(11, cents, 1);
cents = cents % 1;
printf("+----+--------------+-------+\n");
}
int main(void)
{
int dollars, cents;
printf("Please enter total value: ");
int n = scanf("%d.%d", &dollars, ¢s);
if (n != 2)
{
printf("You did not type in the correct format in terms of dollars and cents.\n");
}
else if (dollars < 0)
{
printf("You did not type in the correct format in terms of dollars and cents.\n");
}
else if (cents < 0 || cents > 99)
{
printf("You did not type in the correct format in terms of dollars and cents.");
}
else
{
int total_cents = dollars * 100 + cents;
coins(total_cents);
}
return 0;
printf("main()\n");
}

My code looks like this. For line

float cents_part = (float)value % 100;

it gives an error

invalid operands to binary % (have ‘float’ and ‘int’)

. How do I fix this?

**What I have tried:**
Honestly I'm quite lost, still new to this for school.