Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Kata
  5. {
  6. public static int problem(int A, int B)
  7. {
  8.  
  9. int z = A - B;
  10. Console.WriteLine("The z number that" + z +" " + z.ToString().Count());
  11. var q = z.ToString()
  12. .ToCharArray()
  13. .Select(x => char.GetNumericValue(x))
  14. .ToList();
  15.  
  16. for (int i = 0; i < q.Count; i++)
  17. {
  18. if (q[i] >= 1)
  19. {
  20.  
  21. if (q[i] == 1 && i == 0 || q[i] == 1 && i == q.Count - 1)
  22. {
  23. continue;
  24. }
  25. else
  26. {
  27. q[i] = q[i] - 1;
  28. var Q = q.Aggregate("", (c, n) => c + n);
  29. Console.WriteLine("the return value. "+ Q +" "+ Q.ToString().Count() );
  30. return Convert.ToInt32(Q);
  31. }
  32.  
  33. }
  34. }
  35.  
  36. return 0;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement