whats wrong with code,can someone give me a testcase for which it does not work
#include<stdio.h>
#include<stdlib.h>
int t,p,c[10],i,flag=0;
int cnt=0,num;
int main()
{
scanf("%d",&t);
while(t)
{
for( i=0;i<10;i++)
{
scanf("%d",&c[i]);
}
num=0;
flag=0;
num=num*10 + getsmallest(1);
while(flag==0)
{
num=num*10 + getsmallest(0);
}
printf("%d\n",num);
t--;
}
return 0;
}
int getsmallest(int i)
{
int index,m=9;
for(;i<10;i++)
{
if(c[i]<m)
{
index=i;
m=c[i];
}
}
if(m==0)
flag=1;
else
c[index]--;
return index;
}``