I know logic first-I have to include numbers then i hve to count maybe with k++ then I have to divide sum of numbers to k--but i cant write it in program esp..first stage how i can include numbers without knowing quantity of them
#include <iostream>
usingnamespace std;
#define maxLenght 10000
int main()
{
int lenght;
cout<<"Enter the lenegt of the array: ";
cin>>lenght;
double myArray[maxLenght];
for(int i = 0; i < lenght; i++)
{
cout<<"Enter value with index: "<<i<<endl;
cin>>myArray[i];
}
cout<<"\n";
double avg;
double sum = 0;
for(int i = 0; i < lenght; i++)
{
sum += myArray[i];
avg = sum / lenght;
}
cout<<"Avg is: "<<avg<<endl;
cin.get(); cin.get();
return 0;
}