In examination the grades are awarded to the students in science according to the average marks obtained in the examination :
Marks Grades
80% and above Distinction
60% or more but less than 80% First Division
45% or more but less than 60% Second Division
40% or more but less than 45% Pass
less then 40% Promotion not granted
Write a program to input name and marks in physics, chemistry and biology .Calculate the average marks. Display the name, average marks and the grade obtained.
Answers
Answer:
#include<iostream.h>
using namespace std;
int main()
{
int rollno[],biology[], physics[], chemistry[],sum[], avg[],n;char name[];
cout<<"Enter no of Students";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"Enter rollno:\n";
cin>>rollno[i];
cout<<"Enter name of student:\n"
gets(name [i]);
cout<<"Enter marks of Biology";
cin>>biology [i];
cout<<"Enter marks of chemistry";
cin>>chemistry[i];
cout<<"Enter marks of physics";
cin>>physics;
sum[i]=physics [i]+chemistry [i]+physics [i];
avg[i]=sum[i]/3;
}
for(int i=0;i<n;i++)
{
cout<<"roll no:"<<rollno[i]<<"Name:"<<name[i]<<"Average marks:"<<avg[i]<<"Grade obtained";
if(avg[i]>=80)
cout<<"Distinction";
elseif(avg[i]<80&&avg[i]>=60)
cout<<"first division";
elseif(avg[i]<60&&avg[i]>=45)
cout<<"Second division";
elseif(avg[i]<45&&avg[i]>=40)
couy<<"pass";
else
cout<<" promotion not granted";
}
Explanation:
please complie the program once and if any error occurs u can contact me...
This program can be made by many methods i.e functions,classes,structures...