Here is my code to count the sum of 5 and 1 coin of a certain money to be the less. But I have to assign variable c to variable v because if not do so, the program will stop if the money is less than 5 in the first place. Can anyone tell me how I can get the value of variable c after a loop without assign it to another variable?
int c;
int i;
int k;
do
{
c = get_int ("c: ");
} while (c < 0);
for (i = 0; c >= 5 ; i++)
{
c = c - 5;
}
int v = c;
for (k = 0 ; c >= 1 ; i++)
{
v = v -1 ;
}
printf("%i\n", i + k);