Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
2.6k views
in Computer by (45.3k points)
closed by

Write the definition of a function AddUp(int Arr[ ], int N) in C++, in which all even positions (i.e. 0, 2, 4,….) of the array should be added with the content of the element in the next position and odd positions (i.e. 1, 3, 5,……) elements should be incremented by 10.

Example: if the array Arr contains

23 30 45 10 15 25

Then the array should become

53 40 55 20 40 35

Note:Then the array should become

  • The function should only alter the content in the same array.
  • The function should not copy the altered content in another array.
  • The function should not display the altered content of the array.
  •  Assuming, the Number of elements in the array are Even.

1 Answer

+1 vote
by (50.9k points)
selected by
 
Best answer

void AddUp(int Arr[], int N)

{

for(int i = 0; i<N; i++)

{

if(i82==0)

Arr[i]+ = Arr[i+1];

else

Arr[i]+ = 10;

}

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...