Robotic Moves

Problem

A robot's initial position is(0,0)  and it can only move along X-axis. It has N moves to make and in each move, it will select one of the following options:
     1.Go to(X-1,0) from (X,0)
     2.Go to(X+1,0) from (X,0)
     3.Remain at its current position
Your task is to calculate Σ(abs(X)+abs(Y)) for all reachable(X,Y) .

C Solution:
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5.     int t;
  6.     long long int n;
  7.     scanf("%d", &t);
  8.     while(t--)
  9.     {
  10.         scanf("%lld", &n);
  11.         printf("%lld\n", n*(n+1)); // for counting the no. of steps 
  12.     }
  13. }
Note:
       We Are Providing Every Content in this Blog Inspired From Many People and Provide it Open To All People Who Are Willing Gain Some Stuff in Computer Science.

Comment Below👇 If You Find Better Solution Than Above Solution.