The Lazy Caterer 's Problem | Java program to find the solution to The Lazy Caterer 's Problem ; This function returns the maximum number of pieces that can be made form pancake using n cuts ; Use the formula ; Driver program to test above function
import java . io . * ; class GFG { static int findPieces ( int n ) { return ( n * ( n + 1 ) ) / 2 + 1 ; } public static void main ( String [ ] args ) { System . out . println ( findPieces ( 1 ) ) ; System . out . println ( findPieces ( 2 ) ) ; System . out . println ( findPieces ( 3 ) ) ; System . out . println ( findPieces ( 50 ) ) ; } }