This is different than previous uploaded question please see carefully.
I have one array called ans[i].
ans[i]={1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} //n no.of inputed element.Not fix array
and i want to split in group of 3 and stored it in array.
Like this if x=2 the it should store the summation of 1+4+7+10+13..like below.
res[0]= 35 //1+4+7+10+13
res[1]=40 //2+5+8+11+14
res[2]=45 //3+6+9+12+15
if x=3 then,
res[0]=1+5+9+13
res[1]=2+6+10+14
res[2]=3+7+11+15
res[3]=4+8+12+16
if x=1 then
res[0]=1+3+5+7+9+11+13+15
res[2]=2+4+6+8+10+12+14+16
if x=4,5... for n no of input for n size of an array.
please give code for this.
4 Replies
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.
ketan borsdiyaPosted Oct 7, 2016, 12:25 AM
Pruthvi PatelPosted Oct 6, 2016, 12:56 PM
Nirav DaraniyaPosted Oct 6, 2016, 9:04 AM
ketan borsdiyaPosted Oct 6, 2016, 7:43 AM