Computer Science, asked by yashasvibakshi81, 10 months ago

Write a program to insert a user inputted value ‘n’ into an array of maximum size ‘m’. Please help me

Answers

Answered by guddysingha1988
1

Answer:

After m operations, we need to calculate the maximum of the values in the array.

Examples:

Input : n = 5 m = 3

a = 0, b = 1, k = 100

a = 1, b = 4, k = 100

a = 2, b = 3, k = 100

Output : 200

Explanation:

Initially array = {0, 0, 0, 0, 0}

After first operation:

array = {100, 100, 0, 0, 0}

After second operation:

array = {100, 200, 100, 100, 100}

After third operation:

array = {100, 200, 200, 200, 100}

Maximum element after m operations

is 200.

Similar questions