(https://www.codechef.com/problems/FLOW005)...What's wrong in my program for the question FLOW005?

#include<stdio.h>
int main()

{
int test,amount,note,i,c=0;

scanf("%d",&test);

while(test>0)

{
scanf("%d",&amount);

for(i=100;i>1;)

{
note=amount/i;

amount=(amount-(note*i));

c=c+note;

if(i==50)

{
    i=i-40;
}
else
    i=i/2;

}
printf("%d\n",c);

c=0;

test–;

}
return 0;
}

Your loop end condition doesn’t allow Rs. 1 notes to be counted. You break the loop when i==1 before 1-value notes have been assessed.