Code : http://ideone.com/FtzkyM
What is the error in my code?
After taking the input, the nested for
loops are used to compare all the elements of array b
(where I have stored the weights of the pies), with all elements of array c
(where I have stored the eight limits of the racks). If the weight of a pie is greater than the weight limit of a rack, variable f
is incremented by 1. If at the end of the inner for
loop, f
is equal to d
(the number of pies), g
is incremented by 1. g
is used for counting the number of pies that can not be cooled. The result is d - g
(total pies minus the number of pies that can't be cooled).