How do I code a C++ program that used an array to find an average of positive numbers. Then outputs the result
csaund1 0 Newbie Poster
Recommended Answers
Jump to Postsum them all up and divide by the size of the array. For example
int a[3] = {2,4,6}; The sum is 2+4+6 = 12 The average is 12/3 = 4
All 4 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ψmon 2 Light Poster
StuXYZ 731 Practically a Master Poster
chococrack 74 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.