title: Product of all digits of an integer number C#
body: <p>I am attempting to write a recursive program that will take user inputted number then have the program be able to calculate the product of all digits of the integer. I have worked out how I want the program to run, but am unable to work out how I should run my loop to calculate the product of all the digits. I have found out that you can do this in the language c by using num%10 which retrieves the last digit of num, and num/10 to peel off one digit at a time from the end of the integer. I am just unable to work out how I could implement this in C# and how the if/else structure should be.</p>
  
  <p>Below is my code I have written for the program already aside from writing code for the of the if/else statement. If anybody would be able to point me in the right direction of how to achieve this, that would be appreciated.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using static System.Console;
  
  namespace _3
  {
  class Tester
   {
      public static void Main(string[] args)
      {
          int length;
          Write("Enter a number: ");
          string num = Console.ReadLine();
          length = num.Length;
          int productofnum = Int32.Parse(num);
          productofnum = CalcProduct(productofnum);
          WriteLine("The product of all digits of the number {0} is {1}.",num, productofnum);
      }
      public static int CalcProduct(int num)
      {
          int length = num.ToString().Length;
          if (length == 0)
          {
  
          }
          else
          {
          }
          return num;
      }
   }
  }
  </code></pre>