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:
- Program for Area Of Square
- Program to find the area of a Square
- Program to find the surface area of the square pyramid
- Program to calculate area of an Circle inscribed in a Square
- Sum of Area of all possible square inside a rectangle
- Area of a leaf inside a square
- Area of square Circumscribed by Circle
- Area of a Circumscribed Circle of a Square
- Area of a square from diagonal length
- 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
- Program to find the Area of a Parallelogram
- Program to calculate Area Of Octagon
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.