Related Articles
Count pieces of circle after N cuts
• Difficulty Level : Basic
• Last Updated : 03 May, 2021

Given an integer N, where . The task is to print the count of pieces of a circle with N cuts where each cut passes through the centre of given circle.
Examples

Input : N = 2
Output : 4

Input : N = 100
Output : 200

Approach: This problem can be easily solved with observation only. Since each cut passes through the centre, each cut creates two new pieces.
Let us see how above Intuition works.

• At first cut we have 2 different pieces of circle.
• At second cut we have 2 new different pieces from previous 2 pieces of circle.
• At third cut we have again 2 new different pieces from any of previous 2 pieces which are opposite to each other.

In this way, we proceed with N cuts to get the count of total pieces after N cuts.
Below is the implementation of above approach:

## C++

 // C++ program to find number of pieces// of circle after N cuts #include using namespace std; // Function to find number of pieces// of circle after N cutsint countPieces(int N){    return 2 * N;} // Driver programint main(){    int N = 100;     cout << countPieces(N);     return 0;}

## Java

 // Java program to find number of pieces// of circle after N cutsimport java.util.*; class solution{ // Function to find number of pieces// of circle after N cutsstatic int countPieces(int N){    return 2 * N;} // Driver programpublic static void main(String args[]){    int N = 100;     System.out.println(countPieces(N)); } }

## Python3

 # Python program to find number# of pieces of circle after N cuts # Function to find number of# pieces of circle after N cutsdef countPieces(N):    return 2 * N # Driver CodeN = 100 print(countPieces(N)) # This code is contributed by# Sanjit_Prasad

## C#

 // C# program to find number of pieces// of circle after N cuts class solution{ // Function to find number of pieces// of circle after N cutsstatic int countPieces(int N){    return 2 * N;} // Driver programstatic void Main(){    int N = 100;     System.Console.WriteLine(countPieces(N)); } }// This code is contributed by mits

## PHP

 

## Javascript

 
Output:
200

Time Complexity: O(1)

Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up