Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static int NumAVGMain(int num)
- {
- int sum = NumAVG(num);
- return sum / num.ToString().Length;
- }
- static int NumAVG(int num)
- {
- if (num < 10)
- return num;
- int total = num % 10 + NumAVG(num / 10);
- return total;
- }
- static void Main(string[] args)
- {
- Console.WriteLine(NumAVGMain(123));
- Console.ReadKey();
- }
- }
Add Comment
Please, Sign In to add comment