Find the average of first N natural numbers | Java Program to find the Average of first n natural numbers ; Return the average of first n natural numbers ; Driven Program
import java . io . * ; class GFG { static float avgOfFirstN ( int n ) { return ( float ) ( 1 + n ) / 2 ; } public static void main ( String args [ ] ) { int n = 20 ; System . out . println ( avgOfFirstN ( n ) ) ; } }