By using this programyou can find average of maximum 50 numbers.
c++ code
#include <iostream.h> void main() { int A[50],n; float sum=0; cout<<"How many numbers do you wish to enter : "; cin>>n; cout<<"\nEnter numbers : "; for(int i=0;i<n;i++) { cin>>A[i]; sum+=A[i]; } cout<<"\nAverage = "<<sum/n; }
OUTPUT-
How many numbers do you wish to enter :5
Enter numbers :5 4 8 7 6
Average =6
Comments
Post a Comment