fork download
  1. using System;
  2. namespace testCounting
  3. {
  4. public class Counting
  5. {
  6. public static void Main(string[] args)
  7. {
  8. int counter,copy,sum;
  9. counter = 0;
  10. int[] digits = new int[5];
  11. for(int number=10000;number<100000;number++)
  12. {
  13. copy = number;
  14. for(int j=4;j>=0;j--)
  15. {
  16. digits[j] = copy%10;
  17. copy = copy /10;
  18. }
  19. sum = 0;
  20. for(int j = 0;j < 5;j++)
  21. sum += digits[j];
  22. if(sum == 22)
  23. counter++;
  24. }
  25. Console.WriteLine("{0}",counter);
  26. Console.ReadKey();
  27. }
  28. }
  29. }
Success #stdin #stdout 0.02s 16044KB
stdin
Standard input is empty
stdout
5460