using System; namespace testCounting { public class Counting { public static void Main(string[] args) { int counter,copy,sum; counter = 0; int[] digits = new int[5]; for(int number=10000;number<100000;number++) { copy = number; for(int j=4;j>=0;j--) { digits[j] = copy%10; copy = copy /10; } sum = 0; for(int j = 0;j < 5;j++) sum += digits[j]; if(sum == 22) counter++; } Console.WriteLine("{0}",counter); Console.ReadKey(); } } }