Tetrahedral Numbers | Java Program to find the nth tetrahedral number ; Function to find Tetrahedral Number ; Driver Code
class GFG { static int tetrahedralNumber ( int n ) { return ( n * ( n + 1 ) * ( n + 2 ) ) / 6 ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( tetrahedralNumber ( n ) ) ; } }