#include <iostream>
using namespace std;

int main ()
{
	int subjects,i;
	double *marks,totalmarks,average;
	marks=new double[subjects];//Allocate memory
 	
 	cout<<"Please enter number of subjects taken: ";
 	cin>>subjects;
 	cout<<endl;
 	
 	cout<<"Please enter the marks of each subject."<<endl;
 	cout<<endl;
 	
 	for (i=0;i<subjects;i++)
 	{
 		cout<<"Subjects "<<i+1<<": ";
 		cin>>marks[i];
 		totalmarks+=marks[i];
	 }
 	
 	cout<<"Total of marks: "<<totalmarks<<endl;
 	
 	average = totalmarks/subjects;
 	
 	cout<<"Average: "<<average<<endl;
 	
 	delete marks;//Free memory
 	 *marks=0;
 	
  return 0;
}

