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

MRK - Fall 2024 - CS201P - 1 - BC240222669

The document contains a C++ program that calculates a student's marks, average, grade, highest, and lowest marks based on input for three subjects. It validates the input to ensure marks are between 0 and 100 and assigns a grade based on the average. Finally, it displays the results including obtained marks, average, grade, highest, and lowest marks.

Uploaded by

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

MRK - Fall 2024 - CS201P - 1 - BC240222669

The document contains a C++ program that calculates a student's marks, average, grade, highest, and lowest marks based on input for three subjects. It validates the input to ensure marks are between 0 and 100 and assigns a grade based on the average. Finally, it displays the results including obtained marks, average, grade, highest, and lowest marks.

Uploaded by

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

#include<iostream>

#include<conio.h>
using namespace std;

main()
{
int marks [3], obtainedMarks = 0 , highestMark, lowestMark;
float averageMarks;
char grade;

cout << "Student ID: BC240222669";


cout << "\nSaba Azhar\n";

int i = 0;
while(i <= 2)
{
do{
cout << "Enter mark for subject " << i+1 << ": ";
cin >> marks[i];
if(marks[i] < 0 || marks[i] > 100)
{
cout << "Invalid input. Please enter marks between 0 and 100.\
n";
}
}while (marks[i] < 0 || marks[i] > 100);
obtainedMarks += marks[i];
i++;
}

averageMarks = obtainedMarks / 3;

if (averageMarks >= 90)


grade = 'A';
else if(averageMarks >= 80)
grade = 'B';
else if(averageMarks >= 70)
grade = 'C';
else if(averageMarks >= 60)
grade = 'D';
else
grade = 'F';

highestMark = marks[0];
lowestMark = marks[0];

for(int a = 1; a <= 2; a++)


{
if(highestMark < marks[a])
{
highestMark = marks[a];
}
if(lowestMark > marks[a])
{
lowestMark = marks[a];
}
}

cout << "\nMarks have been entered. Here is your result:\n";


cout << "Obtained marks out of 300: " << obtainedMarks;
cout << "\nAverage Mark: " << averageMarks;
cout << "\nGrade: " << grade;
cout << "\nHighest Mark: " << highestMark;
cout << "\nLowest Mark: " << lowestMark;

getch();
return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy