MuffinMonster

Class Task 61#

Nov 1st, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. class Program
  2.     {
  3.         static int NumAVGMain(int num)
  4.         {
  5.             int sum = NumAVG(num);
  6.             return sum / num.ToString().Length;
  7.         }
  8.         static int NumAVG(int num)
  9.         {
  10.             if (num < 10)
  11.                 return num;
  12.             int total = num % 10 + NumAVG(num / 10);
  13.             return total;
  14.         }
  15.         static void Main(string[] args)
  16.         {
  17.             Console.WriteLine(NumAVGMain(123));
  18.             Console.ReadKey();
  19.         }
  20.     }
Add Comment
Please, Sign In to add comment