Count and add

Write a procedure

        void count_and_add(int& num, int& sum);

to read a sequence of integer numbers until its end, and store in @num@
how many numbers it has, and store in @sum@ the sum of those numbers.
For instance, if the input sequence is

    10 -3 23

the values after the call must be @num@  = 3 and @sum@  = 30.

Observation

You only need to submit the required procedure; your main program will
be ignored.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:39:37.156Z

© Jutge.org, 2006–2026.
https://jutge.org
