0% found this document useful (0 votes)
20 views2 pages

Cs101 Assignment 2 Solution 2023

Uploaded by

abdullahyousafb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Cs101 Assignment 2 Solution 2023

Uploaded by

abdullahyousafb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Cs101 assignment 2 solution 2023

#include <iostream>
#include <string>
using namespace std;
int main() {
string vuId;
int cs, math, pakStudy, mgt;
// Input section
cout << "Enter your VU-ID: ";
cin >> vuId;

cout << "Enter Marks for CS: ";


cin >> cs;

cout << "Enter Marks for Math: ";


cin >> math;

cout << "Enter Marks for Pak Study: ";


cin >> pakStudy;

cout << "Enter Marks for MGT: ";


cin >> mgt;

// Calculation section
int totalMarks = cs + math + pakStudy + mgt;
float averageMarks = totalMarks / 4.0;
// Output section
cout << "\nTotal Marks: " << totalMarks << endl;
cout << "Average Marks: " << averageMarks << endl;
// Grading section
string finalGrade;
if (averageMarks >= 91 && averageMarks <= 100)
finalGrade = "A+";
else if (averageMarks >= 81 && averageMarks < 91)
finalGrade = "A-";
else if (averageMarks >= 71 && averageMarks < 81)
finalGrade = "B+";
else if (averageMarks >= 61 && averageMarks < 71)
finalGrade = "B-";
else if (averageMarks >= 51 && averageMarks < 61)
finalGrade = "C";
else if (averageMarks >= 41 && averageMarks < 51)

finalGrade = "D";
else if (averageMarks >= 35 && averageMarks < 41)
finalGrade = "E";
else if (averageMarks >= 0 && averageMarks < 35)
finalGrade = "Fail";
else
finalGrade = "Invalid";
cout << "Final Grade: " << finalGrade << endl;
return 0;
}

You might also like