i got this error(error C2297: '%' : illegal, right operand has type 'double') in this programmig,
who can help me?
who can help me?
Code:
#include<stdio.h>
int main(void)
{
printf("Amount of sale ($):\t");
float a;
scanf("%f", &a);
printf("Cash tendered ($):\t");
float b;
scanf("%f", &b);
int twenties,tens,fives,ones;
printf("Change:\n");
float c;
c = b - a;
printf("twenties:\t");
twenties=c/20;
printf("%d",twenties);
int m,l,o,q,d,n,p;
m=(c%20);
printf("tens:\t");
tens=m/10;
printf("%d",tens);
l=(m%10);
printf("fives:\t");
fives=l/5;
printf("%d",fives);
o=(l%5);
printf("ones:\t");
ones=o/1;
printf("%d",ones);
int quarters,dimes,nickels,pennies;
q=(o%1);
printf("quarters:\t");
quarters=q/0.25;
printf("%d",quarters);
d=(q%0.25);
printf("dimes:\t");
dimes=d/0.10;
printf("%d",dimes);
n=(d%0.10);
printf("nickels:\t");
nickels=n/0.05;
printf("%d",nickels);
p=(n%0.05);
printf("pennies:\t");
printf("%d",p);
return 0;
}
Comment