I am not getting the required answer while printing l array.
Doubt in printing array
@akash_281, i don’t know what u are trying to do but you have not assigned any value to your array l[1000],it is taking value 0 as default and doing
l[i]=max(l[i],a[i]);
will assign value of a[i] to l[i]
and you are getting value of a[i] , which is indeed what result should be