Birthday Candles

I cannot seem to find the problem with my code. Any help will be appreciated.

try this case…ans should be 100…urs is giving 110…

1
1 2 2 2 2 2 2 2 2 2

EDIT

this is your corrected code…

#include<stdio.h>
int main(){
    long long t,a[11]={0},i,age,index,min;
    scanf("%lld",&t);
    while(t--){
		scanf("%lld ",&a[10]);
		for(i=1;i<10;i++)
			scanf("%lld",&a[i]);
		min=a[1];
		index=1;
		for(i=2;i<11;i++){
			if(a[i]<min){
				index=i;
				min=a[i];
			}
		}
        if(index!=10)
        {
            age=0;
		    for(i=1;i<=min+1;i++){
		    	age=age*10+index;
		    }
		    printf("%lld\n",age);
        }
        else
        {
            age=1;
            for(i=1;i<=min+1;i++){
    	    	age=age*10;
		    }
		    printf("%lld\n",age);
        }
	}
	return 0;
}

hope you understood what mistake u were making…:slight_smile:

2 Likes

Thanks you! :slight_smile:

glad could help…:slight_smile: