Write a function int sumIf(int a, int b) in C that returns t…
Write a function int sumIf(int a, int b) in C that returns the sum of non-negative ints a and b with the following conditions: If the number of digits in the sum is same as a, return the sum. Otherwise, if the sum has more digits than a, just return a without b. Write a helper function int d( int n) that returns the number of digits in the non-negative int n, then sumIf(a, b) = a + b if d(a + b) = d(a) sumIf(a, b) = a if d(a + b) > d(a) sumIf(a, b) = b if d(a + b) < d(a) // This condition will never be reached Examples sumIf(45, 10) -> 55 // since d(45+10) = 2 and d(45) = 2, there sumIf(45, 10) = 45 + 10 sumIf(99, 2) -> 55 // since d(99+2) = 3 and d(45) = 2, therefore sumIf(99, 2) = 99 sumIf(0, 5) -> 5 // since d(0+5) = 1 and d(0) = 1, therefore sumIf(0, 5) = 5