I receive this error:
24 C:\WINDOWS\Desktop\oved.c
invalid operands to binary %
This is the line:
//Evaluate the minutes
mins = ((tops * MIN_PER_TOP) % MIN);
And this is the code:
Code:
#include <stdio.h>
#include <stdlib.h>
#define MIN_PER_TOP 10 //Minutes per top
#define MONEY_PER_TOP 6.3 //Money per top
#define MIN 60 //Minutes
#define MIN_PER_HOUR 3600 //Minutes per hour
int main()
{
float tops, money, hours, mins;
//Get the tops value
printf("How many tops? : ");
scanf("%f",&tops);
//Evaluate the money
money = tops * MONEY_PER_TOP;
//Evaluate the hours
hours = (tops * MIN_PER_TOP) / MIN;
//Evaluate the minutes
mins = ((tops * MIN_PER_TOP) % MIN);
printf("\nThe worker made %.1f shekels cuz he made %.1f tops in %.1f hours and %.1f mins \n",money,tops,hours,mins);
system("pause");
return 0;
}
Thanks.