Aggregate Calculation

Description:

A company wants to calculate the aggregate of a student to decide whether he is eligible for the post.A student might be a class 10th or 12th passed out. If he is in class 10,input marks of 4 subjects. if he is is class 12,input marks of 3 subjects. Calculate his average ,if average is more than 80%,he is eligible. Input:First line contains class Second line contain marks Test Case 1 Input (stdin) 10 50 50 50 50 Expected Output NOT ELIGIBLE Test Case 2 Input (stdin) 12 95 95 95 Expected Output ELIGIBLE

Program :

#include <iostream>

 using namespace std;

 int main()

 {

int h,a,b,c,d,e;

 cin>>h;

if(h==10)

{

 cin>>a>>b>>c>>d;

e=(a+b+c+d)/4;

if( e > 80) cout<<"ELIGIBLE";

 else cout<<"NOT ELIGIBLE";

}

else { cin>>a>>b>>c;

e=(a+b+c )/3;

if ( e > 80 ) cout<<"ELIGIBLE";

 else cout<<"NOT ELIGIBLE";

 }

return 0;

 }