Skip to content

Commit

Permalink
Merge pull request #290 from amous4822/master
Browse files Browse the repository at this point in the history
program to calculate no. of squares that can fit in a triangle
  • Loading branch information
i-vishi authored Oct 20, 2018
2 parents 0ea26dd + 076d70b commit 7557289
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Other Algorithms/Fit_square_in_equilateral_triangle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include<iostream>
#include<math.h>
using namespace std;

int main(){

int cases, base;
cin>>cases;

while(cases--){

cin>>base;
base=(base/2)-1;
base=(base*(base+1))/2;
cout<<base<<endl;
}
return 0;
}

0 comments on commit 7557289

Please sign in to comment.