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 to find the area of a Square
- Program for Area Of Square
- Program to calculate area of an Circle inscribed in a Square
- Program to find the surface area of the square pyramid
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Nth Square free number
- Nth non-Square number
- Area of a square from diagonal length
- Area of a Circumscribed Circle of a Square
- Area of square Circumscribed by Circle
- Sum of Area of all possible square inside a rectangle
- Area of a largest square fit in a right angle triangle
- Area of the Largest square that can be inscribed in an ellipse
- 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
- Area of a leaf inside a square
- 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
- Largest area square in an array when elements can be shuffled
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.