Vidyalelo
C++ Programming · Q123

Functions and Procedures in C++

Programming · C++ Programming · question 123

Q123

What will be the output of the following C++ code? #include #include 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
Answer
B.
5
C.
6
D.
7

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board