Sum of first n odd numbers in O ( 1 ) Complexity | Returns the sum of first n odd numbers ; Driver code
function oddSum ( n ) { return ( n * n ) ; } let n = 20 ; document . write ( " " + n + " " + oddSum ( n ) ) ;