From 076d70b39993d64837c9337c8fd922df06e615f6 Mon Sep 17 00:00:00 2001 From: Albin Joseph Date: Fri, 19 Oct 2018 19:09:04 +0530 Subject: [PATCH] program to calculate no. of squares that can fit in a triangle --- .../Fit_square_in_equilateral_triangle.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Other Algorithms/Fit_square_in_equilateral_triangle.cpp diff --git a/Other Algorithms/Fit_square_in_equilateral_triangle.cpp b/Other Algorithms/Fit_square_in_equilateral_triangle.cpp new file mode 100644 index 000000000..7dee85b91 --- /dev/null +++ b/Other Algorithms/Fit_square_in_equilateral_triangle.cpp @@ -0,0 +1,18 @@ + #include + #include + using namespace std; + + int main(){ + + int cases, base; + cin>>cases; + + while(cases--){ + + cin>>base; + base=(base/2)-1; + base=(base*(base+1))/2; + cout<