Pizza cut problem

 What is the maximum number of pieces possible for n cuts in a pizza?



class MaxPieces {
     
    // Function for finding maximum pieces
    // with n cuts.
    static int findMaximumPieces(int n)
    {
        return 1 + n * (n + 1) / 2;
    }
     
    // Driver Program to test above function
    public static void main(String arg[])
    {
         
        System.out.print(findMaximumPieces(3));
    }
}

Comments

Popular posts from this blog

Get first non-repeating Letter

Cypress run command

Docker commands