Square Game

Sita wanted to celebrate the good news of her promotion. She took her neice Mahirl along with her and went to Fun Mall to meet her close friend Gita.
                       

Gita was busy with her customers and she asked her to wait for an hour.

       

Mahirl grew restless sitting idle. So Sita took her around the Mall. A competition for kids was going on in the 1st floor.


They were given 'n' fancy sticks in different colors of 2 cm length and they were asked to form the largest square possible.

       ................>    

Many kids were playing with the fancy sticks. Mahirl always likes colorful sticks and she also wanted to take part in the competition.
But the organisers told that the competition is open only for kids above 10 years.

        

Mahirl started crying and they allowed her to participate in the contest.


They asked to Sita to give her instructions. But Sita should not touch any of the sticks.
Sita has good reasoning skills and she was wondering what could be the area of the largest square that can be formed using 'n' sticks.
                    
Can you help Sita out and help Mahirl in winning the prize?


Input and Output Format:

Input consists of a single integer, n.
Output consists of a single integer that corresponds to the area of the largest square that is possible to be formed using n sticks.


Sample Input:
9

Sample Output:
16
01  #include
02int main()
03{
04  int n,a,b=2;
05  scanf("%d",&n);
06  if(n%4)
07  {
08    a=(n/4)*b;
09    a=(a)*(a);
10  }
11  else
12  {
13    do{
14      n=n-1;
15       }
16      while(n%4);
17  a=(n/4)*b;
18  a=(a)*(a);
19}
20  printf("%d ",a);
21  return 0;
22}

Option 1 - 90 

Option 2 - 39 

Input 3 - 100 

Option 4 - 9 

No comments: