Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- public class Kata
- {
- public static int problem(int A, int B)
- {
- int z = A - B;
- Console.WriteLine("The z number that" + z +" " + z.ToString().Count());
- var q = z.ToString()
- .ToCharArray()
- .Select(x => char.GetNumericValue(x))
- .ToList();
- for (int i = 0; i < q.Count; i++)
- {
- if (q[i] >= 1)
- {
- if (q[i] == 1 && i == 0 || q[i] == 1 && i == q.Count - 1)
- {
- continue;
- }
- else
- {
- q[i] = q[i] - 1;
- var Q = q.Aggregate("", (c, n) => c + n);
- Console.WriteLine("the return value. "+ Q +" "+ Q.ToString().Count() );
- return Convert.ToInt32(Q);
- }
- }
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement