DSA SheetLesson · no judge

CODE DRILL 1 · RUN ONLY

Write it, run it, read the output

This is a scratch drill — your code runs, nothing is graded or recorded. No test cases, no expected output, no verdict.

TASK

Declare the array [-4, -2, -7, -1]. Use one index-based loop to compute its sum, count its even values, and find its maximum. Initialize the maximum from the first array element, then print the three results on separate lines.

C++
Loading editor…

OUTPUT

Sample
-14
2
-1

What a finished answer prints, from the lesson. Nothing has run yet — press Run and this is replaced by your program’s own output.

Previous · Iterating Through ArraysNext part · Code drill 2