i have got to write a program to read a set of program n print out the average.
it will start by prompting the user for the number of numbers to be read and will then prompt for the individual numbers with a prompt such as Enter Number 23 to indicate to thr user which data item is currently being entered.now all that is easy but i have to do something special when prompting for the last number.here is what io have done but am unable to include the special thing for the last number have tried to put it in the loop an its displaying me 6 time the cout<<"enter the last number".i have written this program the way my lecturer has teach us.here is the program
// program to read set of number and print out their average
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,x,sum;
float average;
cout<<"Enter the number of numbers to be read"<<endl;
cin>>n;
sum=0;
for(i=1;i<=n;i++)
{
cout<<"Enter number"<<endl;
cin>>x;
sum=sum+x; }
average=sum/n;
cout<<"the average of the numbers is"<<average<<endl;
getch();
}