# Money In Bank | Codestudio Solution

## Money In Bank | Codestudio Solution

#### For example :

``````Given ‘N’ = 2
On Day 1 = 1
On Day 2 = 2
Total Amount = 1 + 2 = 3.
``````

#### Input Format :

``````The first line of input contains an integer ‘T’ denoting the number of test cases. The 'T' test cases follow.

The first and the only line of each test case contains a single integer ‘N’ denoting the number of days.
``````

#### Output Format :

``````For each test case, print an integer denoting the total amount of money after N days.

The output of each test case will be printed in a separate line.
``````

#### Constraints :

``````1 <= T <= 10
1 <= N <= 5000

Time limit: 1sec.
``````

#### Sample Input 1 :

``````2
2
7
``````

#### Sample Output 1 :

``````3
28
``````

#### Explanation Of Sample Input 1 :

``````For first test case :
On Day 1 = 1
On Day 2 = 2
Total Amount = 1 + 2 = 3.

For Second Test case :
On Day 1 = 1
On Day 2 = 2
On Day 3 = 3
On Day 4 = 4
On Day 5 = 5
On Day 6 = 6
On Day 7 = 7
Total Amount = 1 + 2 + 3 + 4 + 5 + 6 + 7= 28.
``````

#### Sample Input 2 :

``````2
8
9
``````

#### Sample Output 2 :

``````30
33 ``````
``#include<bits/stdc++.h>int totalMoney(int n){    int total=n/7;    int rem=n%7;       int ans=0,coin=1;    for(int i=0; i<total; i++)        ans+=21+7*coin++;         for(int i=0; i<rem; i++)         ans+=coin++;         return ans;    }https://www.codingninjas.com/codestudio/interview-bundle/de-shaw-india``