Computer Science, asked by frankpatterson202, 2 months ago

a) Create a function with two parameters (continuous assessment score and exam score) to calculate and return the semester mark and the corresponding grade.

Attachments:

Answers

Answered by dreamrob
0

Program in C++

#include<iostream>

using namespace std;

void calculate(double C , double E)

{

double S = C * (30.0 / 100.0) + E * (70.0 / 100.0);

cout<<"Semester score : "<<S<<endl;

if(S >= 70)

{

 cout<<"Grade : A";

}

else if(S >= 60 && S <= 69)

{

 cout<<"Grade : B";

}

else if(S >= 50 && S <= 59)

{

 cout<<"Grade : C";

}

else if(S >= 40 && S <= 49)

{

 cout<<"Grade : D";

}

else

{

 cout<<"Grade : F";

}

}

int main()

{

double C , E;

cout<<"Enter continuous assessment marks (out of 100) : ";

cin>>C;

cout<<"Enter exam score (out of 100) : ";

cin>>E;

calculate(C , E);

return 0;

}

Similar questions