## Problem – Fit Squares in Triangle CodeChef Solution

What is the maximum number of squares of size **2×2** that can be fit in a right angled isosceles triangle of base **B**.

One side of the square must be parallel to the base of the isosceles triangle.

Base is the shortest side of the triangle

### Input

First line contains **T**, the number of test cases.

Each of the following **T** lines contains 1 integer **B**.

### Output

Output exactly T lines, each line containing the required answer.

### Constraints

1 ≤ **T** ≤ 10^{3}

1 ≤ **B** ≤ 10^{4}

### Sample 1:

```
Input:
11
1
2
3
4
5
6
7
8
9
10
11
Output:
0
0
0
1
1
3
3
6
6
10
10
```

## Fit Squares in Triangle CodeChef Solution in C++14

```
#include<bits/stdc++.h>
using namespace std;
int numberOfSquares(int base)
{
base = (base - 2);
base = floor(base / 2);
return base * (base + 1)/2;
}
int main()
{
int t;
cin>>t;
while(t--){
int base;
cin>>base;
cout << numberOfSquares(base)<<endl;
}
return 0;
}
```

## Fit Squares in Triangle CodeChef Solution in Pyth 3

```
# cook your dish here
for _ in range(int(input())):
n = int(input())//2
print(n*(n-1)//2)
```

## Fit Squares in Triangle CodeChef Solution in Java

```
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int B=sc.nextInt();
if(B<3){
System.out.println("0");
}else{
System.out.println(((((B/2)*(B/2))-(B/2))/2));
}
}
}
}
```

##### Fit Squares in Triangle CodeChef Solution Review:

In our experience, we suggest you solve this Fit Squares in Triangle CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Fit Squares in Triangle CodeChef Solution

**Find on CodeChef**

##### Conclusion:

I hope this Fit Squares in Triangle CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

**More Coding Solutions >>**

**LeetCode Solutions**

**Hacker Rank Solutions**

**CodeChef Solutions**