arr[]={1,2,3,4,5,6,6,7,6,5,4,3,7,8,8,8,4,3,2,8....n}
split=2
sum=2
then the result array should be like this.
res[0]=47 //1+2+5+6+6+5+7+8+4+3
res[1]=53 //3+4+6+7+4+3+8+8+2+8
Please help me to do this.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Midhun TpPosted Nov 3, 2016, 1:11 AM
Ifour HirenPosted Nov 3, 2016, 1:53 AM
{
if (args != null)
{
int argument =Convert.ToInt32(args[0]);
int[] arr = { 1, 2, 3, 4, 5, 6, 6, 7, 6, 5, 4, 3, 7, 8, 8, 8, 4, 3, 2, 8 };
int index = 0;
int[] sumarry= new int[argument];
while (index < arr.Length)
{
for (int i = 0; i < argument; i++)
{
sumarry[i] += arr.Skip(index).Take(argument).Sum();
index += argument;
}
}
for (int i = 0; i < argument; i++)
{
Console.WriteLine(sumarry[i]);
}
}
}
above code helps you to make it working.
Rajeev PunhaniPosted Nov 2, 2016, 1:19 PM
Tharu ManickavasagarPosted Nov 2, 2016, 3:30 AM
Pruthvi PatelPosted Nov 1, 2016, 5:12 AM
Pruthvi PatelPosted Oct 31, 2016, 11:15 PM
Manas MohapatraPosted Oct 31, 2016, 3:24 PM
Rajeev PunhaniPosted Oct 31, 2016, 2:55 PM
If the above solution is helpful then,accept the answer.
Tharu ManickavasagarPosted Oct 31, 2016, 11:11 AM