Pizza cut problem
What is the maximum number of pieces possible for n cuts in a pizza?
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
Post a Comment