- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Given a side of a square and the number of fold, we have to find the Area of square after number of folds.

A square is a 2-D shape like rectangle where all the sides are equal. And it’s all angles are equal to 90 degrees.

While folding a square we −

Fold the square from top left side of the triangle to the bottom of the right side forming a triangle.

The second fold will be folding from up to downside.

The third fold is folding again from left to right.

And likewise we follow the above steps.

Input: side = 23, fold = 4 Output: area of square after n folds is : 6.53086

To solve this problem we can follow the below approach −

- Firstly, we have to find the area of a square before folding the square.
- With every fold we have to half the area of the square Area = Area/2.
- Finally we will divide the area of square by pow(2, fold)

START In function double area_nfold(double side, double fold) Step 1-> Decalre and initialize area = side * side Step 2-> Return (area * 1.0 / pow(3, fold)) In int main() Step 1 -> Decalre and initialize double side = 23, fold = 4 Step 2 -> Call function area_nfold(side, fold) and print the results STOP

#include <bits/stdc++.h> using namespace std; //function to calculate area of square after n folds double area_nfold(double side, double fold){ double area = side * side; return area * 1.0 / pow(3, fold); } int main(){ double side = 23, fold = 4; cout <<"area of square after n folds is :"<<area_nfold(side, fold); return 0; }

area of square after n folds is :6.53086

- Related Questions & Answers
- Program for Area Of Square in C++
- C Program for n-th even number
- C Program for n-th odd number
- C Program for N-th term of Geometric Progression series
- C Program for N-th term of Arithmetic Progression series
- C/C++ Program for the n-th Fibonacci number?
- Python Program for n-th Fibonacci number
- Java Program for n-th Fibonacci number
- Area of a leaf inside a square in C Program?
- Divisors of n-square that are not divisors of n in C++ Program
- Java program to find the area of a square
- Program for n’th node from the end of a Linked List in C program
- Program for Surface area of Dodecahedron in C++
- Program for Surface Area of Octahedron in C++
- C Program for Area And Perimeter Of Rectangle

Advertisements