Can you solve this?
Cv
1 int find_max(int nums [], int len)
2{
31 int i, max_num = nums [0];
41 for (i = 1; i < len; i ++)
51 1 if (nums [i] > max_num)
61 II II (Fill in the missing Line here)
71 return max_num;
8 }
Select an answer
nums[i] = max_num
max_nun + 1
max_num = nums (1)
max_num te nums (i)
Answers
Answered by
10
Answer:
Explanation:
nums[i] = max_num
Answered by
8
int find_max(int nums [], int len)
{
int i, max_num = nums [0];
for (i = 1; i < len; i ++){
if (nums [i] > max_num)
max_num = num[i];
}
return max_num;
}
The missing line is highlighted.
Since it is a function for finding the maximum number from an array.
- For that, the first number in the array is assumed to be the maximum.
- After that, a loop is used to traverse the array and compare it with the assumed maximum, and changing it when the greater number is found.
Similar questions