Computer Science, asked by ahmadsanusimoba05, 9 hours ago

Write a c++ program that calculate the average number of age of students,assuming the students are 50?

Answers

Answered by Rudranil420
0

Answer:

\qquad\qquad\underline{\textsf{\textbf{ \color{magenta}{AnSwEr}  }}}

Find Average & Percentage Marks of Student in C++

To calculate average and percentage marks (in 5 subjects) of a student in C++ programming, you have to ask from user to enter marks obtained in 5 subjects.

Now place the summation result of 5 subject's mark in a variable say sum and place sum/5 in a variable say avg (average of 5 subjects). Then place sum/500*100 in a variable say perc (percentage marks), then display the result on the screen as shown here in the following program.

#include<iostream>

using namespace std;

int main()

{

int i, mark[5];

float sum=0, avg, perc;

cout<<"Enter Marks obtained in 5 Subjects: ";

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

{

cin>>mark[i];

sum = sum+mark[i];

}

avg = sum/5;

perc = (sum/500)*100;

cout<<"\nAverage Marks = "<<avg;

cout<<"\nPercentage Marks = "<<perc<<"%";

cout<<endl;

return 0;

}

Similar questions