What will be the output of the following C++ code? [code] #include <iostream> #include <stdarg.h> using namespace std;

What will be the output of the following C++ code?
Code:
    #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 of first 10 whole numbers : " << Average;
        return 0;
    }
A. 4
B. 5
C. 6
D. 7
 

Tìm kiếm

Back
Top