Pantelis has won a voucher C euros from a hypermarket. With this money Pantelis can buy any two items from a list L items, whose total value should be as much the value of the Gift Voucher. Which two objects can buy Pantelis from the list?
Input Format
Integer C (5 <= C <= 100000), the value of the Gift Voucher in euro.
Integer L (3 <= L <= 1000), the objects are listed.
A list of numbers L P (1 <= P <= 100000), the value of each object.
Output Format
For any event be shown in ascending order positions of the two objects in the list.
You are inputting the numbers correctly and sorting the array, but the logic in lines 22-28 is wrong. For example, the loop at lines 22-25 will probably never exit because line 25 assigns the a to some (= operator) rather than comparing them (== operator). Also, i never changes in the loop, so it just keeps computing the same old sum value.
Try to describe the algorithm in words, then translate it into code.
am trying but i don't know how to check if two number are equal = with my begin number :( and after i must know the position but i don't know why can anyone help me ?