Home / Programming MCQs / C++ MCQs / Question

Q. What is the output of this program?

Code:
#include 
    #include 
    using namespace std;
    float avg( int Count, ... )
    {
        va_list num;
        va_start(num, Count);
        int Sum = 0;
        for (int i = 0; i < Count; ++i )
            Sum += va_arg(num, int);
        va_end(num);
        return (Sum/Count);
    }
    int main()
    {
        float AVG = avg(5, 0, 1, 2, 3, 4);
        cout << "Average of first 5 whole numbers : " << AVG;
        return 0;
    }
(A) 2
(B) 3
(C) 4
(D) 5

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.