- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Count pieces of the circle after N cuts in C++
We are given an integer N which represents the number of cuts applied on a 2D-circle. Each circle divides the circle in two halves. Goal is to find the pieces of the circle after N cuts.
Number of pieces= 2 * no. of cuts
Let’s understand with examples.
Input − N=1
Output − Pieces of circle: 2
Explanation −
Input − N=3
Output − Pieces of circle: 6
Explanation −
Approach used in the below program is as follows
We take N for a number of cuts.
Take pieces=1*N.
Print the result..
Example
#include <bits/stdc++.h> using namespace std; int main(){ int N=2; Int pieces=2*N; cout <<endl<<”Number of pieces of circle: ”<<pieces; return 0; }
Output
If we run the above code it will generate the following output −
Number of pieces of circle: 4
- Related Articles
- Maximum number of pieces in N cuts in C++
- Count number of 1s in the array after N moves in C
- Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts in C++
- Count of a, b & c after n seconds for given reproduction rate in C++
- Count number of bits changed after adding 1 to given N in C++
- Count ways to divide circle using N non-intersecting chords in C++
- Count of Smaller Numbers After Self in C++
- Probability that the pieces of a broken stick form a n sided polygon in C++
- C++ program to count final number of characters are there after typing n characters in a crazy writer
- Queries on count of points lie inside a circle in C++
- Find the probability of reaching all points after N moves from point N in C++
- Find the Number of Triangles After N Moves using C++
- Prison Cells After N Days in C++
- Program to count number of palindromes after minimum number of split of the string in C++
- Count number of digits after decimal on dividing a number in C++

Advertisements