Find if given number is sum of first n natural numbers
There is given a sum and you have to find whether this sum is resultant of summation of first n natural numbers or not. If it is summation of first n natural numbers then simply print value of n if that is not the case then simply print -1. Examples : Input : 15 Output : 5 Explanation… Read More »