adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <stdarg.h>
    using namespace std;
    float avg( int Count, ... )
    {
        va_list Numbers;
        va_start(Numbers, Count);
        int Sum = 0;
        for (int i = 0; i < Count; ++i)
            Sum += va_arg(Numbers, int);
        va_end(Numbers);
        return (Sum/Count);
    }
    int main()
    {
        float Average = avg(10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
        cout << Average;
        return 0;
    }

a.

4

b.

5

c.

6

d.

compile time error

Answer: (a).4

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?