I am having the numbers follows taken as strings
My actual number is 1234567890123456789
from this i have to separate it as s=12 s1=6789 s3=3456789012345
remaining as i said
I would like to add as follows
11+3, 2+4, 6+5, 7+6, 8+7, 9+8 such that the output should be as follows
4613579012345
Any help please
Adding the numbers that are stored as strings
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Dorababu MekaRank #457 · 5.5K reputationPosted Jun 24, 2011, 12:01 AM EDT
public static string CombineNumbers(string number1, string number2) { int length = number1.Length > number2.Length ? number1.Length : number2.Length; string returnValue = string.Empty; for (int i = 0; i length; i++) { int n1 = i >= number1.Length ? 0 : int.Parse(number1.Substring(i,1)); int n2 = i >= number2.Length ? 0 : int.Parse(number2.Substring(i,1)); int sum = n1 + n2; returnValue += sum 10 ? sum : sum - 10; } return returnValue; }Chaitanya57 reputationPosted Jun 24, 2011, 1:34 AM EDT