1.

Write a C++ program to read 6 marks of a student and find total and average mark.

Answer»

# include 

using namespace std; 

int main()

{

int mark[6],i,total=0;

float avg;

for(i=0;i<6;i++)

{

cout<<"Enter mark"<<i+1<<":";

cin>>mark[i];

total=total+mark[i];

}

avg=total/6.0;

cout<<"\n The marks are given below\n";

for(i=0;i<6;i++)

cout<<mark[i]<<endl;

cout<<"The total mark is "<<total<<endl;

cout<<"The average mark is"<<avg;

}



Discussion

No Comment Found