//bytelandian coins
#include<stdio.h>
int main()
{
int t=10;
while(t–)
{
long unsigned int n;
scanf("%lu",&n);
long unsigned int a,b,c;
a=n/2;
b=n/3;
c=n/4;
long unsigned int sum=a+b+c;
if(n<sum)
printf("%lu\n",sum);
else
printf("%lu\n",n);
}
return 0;
}
if i start with the coin with 24 written:
i split it into 12, 8 and 6 (at this stage, total = 26)
but, i can split the coin 12 into 6, 4 and 3. (this gives a total of 27 = (6+4+3 + 8 + 6))
so, i can get total value of 27.
but, your code prints it as 26.
this example should help you find more about it.
thanks a lot!