A square is a flat shape, in one plane, defined by four points at the four corners. A square has four sides all of equal length, and four corners, all right angles (90 degree angles). A square is a kind of rectangle.
Given a square of side and number of folds . The task is to find the area of square after F-th fold.
The folding of square is as follows:
- In 1st folding, fold the square from left to right side in the form a triangle.
- In 2nd folding, fold the square from up to down side.
- In 3rd folding, again fold the square from left to right side.
and so on.
Input : N = 4, F = 2 Output : 2 Explanation: Initially square side is 4 x 4 After 1st folding, square side becomes 4 x 2 After 2nd folding, square side becomes 2 x 2 Thus area equals 2 x 2 = 4. Input : N = 100, F = 6 Output : 156.25
- Initially calculate the area of the square before folding.
- After each folding, the area of square reduces by half. That is, area = area/2.
- So, we finally divide the area of square by pow(2, F)
Below is the implementation of above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program for Area Of Square
- Program to find the area of a Square
- Program to calculate area of an Circle inscribed in a Square
- Program to find the surface area of the square pyramid
- Area of a Circumscribed Circle of a Square
- Area of a square from diagonal length
- Area of a leaf inside a square
- Area of square Circumscribed by Circle
- Sum of Area of all possible square inside a rectangle
- Area of the Largest square that can be inscribed in an ellipse
- Area of a largest square fit in a right angle triangle
- Area of a Square | Using Side, Diagonal and Perimeter
- Largest area square in an array when elements can be shuffled
- Area of largest semicircle that can be drawn inside a square
- Minimum area of square holding two identical rectangles
- Find the area of the shaded region formed by the intersection of four semicircles in a square
- Find number of square of area Z which can be built in a matrix having blocked regions
- Find side of Square which makes minimal area to fit two identical rectangles inside it
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Area of a square inscribed in a circle which is inscribed in a hexagon
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.