Seating arrangement of N boys sitting around a round table such that two particular boys sit together | Java implementation of the approach ; Function to return the total count of ways ; Find ( n - 1 ) factorial ; Return ( n - 1 ) ! * 2 ! ; Driver code
import java . io . * ; class GFG { static int Total_Ways ( int n ) { int fac = 1 ; for ( int i = 2 ; i <= n - 1 ; i ++ ) { fac = fac * i ; } return ( fac * 2 ) ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( Total_Ways ( n ) ) ; } }