title: Calculating Sum of Squares in C#
body: <p>I have the following code to calculate the sum of squares.  The logic looks good but it's not the output I'm looking for.</p>
  
  <p>I enter an int value of 3 and get the following response:</p>
  
  <p>The sum of squares for 1 is 1</p>
  
  <p>The sum of squares for 2 is 5</p>
  
  <p>The sum of squares for 3 is 14</p>
  
  <p>What I want to show in the output is only the value I entered.
  "The sum of squares for 3 is 14"</p>
  
  <p>What am I doing wrong here?</p>
  
  <pre><code>using System;
     using System.Collections.Generic;
     using System.Linq;
     using System.Text;
     using System.Threading.Tasks;
  
      namespace Lab4
     {
      class Program
      {
          static void Main(string[] args)
          {
              Statistics();
          }
  
          static void Statistics()
          {
  
              SumofSquares();
  
              Console.ReadLine();
          }
          static void SumofSquares()
          {
              int num;
              Console.Write("Enter an int: ");
              string input = Console.ReadLine();
  
              int.TryParse(input, out num);
              Squares(num);
          }
  
          static long Squares(long value)
          {
              long totalSum;
  
              if (value &gt; 0)
              {
                  totalSum = Squares(value - 1) + (value*value);
  
              }
              else if (value == 1)
              {
                  totalSum = 1;
              }
              else
              {
                  totalSum = 0;
              }
  
  
              return totalSum; 
  
          }
      }
  </code></pre>