Skip to content

Commit

Permalink
program to calculate no. of squares that can fit in a triangle
Browse files Browse the repository at this point in the history
  • Loading branch information
amous4822 authored Oct 19, 2018
1 parent 81fbc4f commit 076d70b
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 076d70b

Please sign in to comment.