Assignment No: 03 Student Name: Iqra Ilyas Student ID: bc210412808 Question No: 01

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Assignment No: 03

Student Name: Iqra Ilyas


Student ID: bc210412808
Question No: 01
Write a C++ program that calculates the total marks and average marks obtained by a student in five
subjects and also computes the division based on the average marks. You are required to enter the marks
for each subject out of 100 marks. The output screen should show your name and student id (VU ID),
obtained marks, average marks, and division as shown in the output diagram (given below):

Use the division system mentioned below to compute the Division using the if-else structure.

Greater than or equal to 60 First Division

Greater than or equal to 45 but less than 60 Second Division

Greater than or equal to 33 but less than 45 Third Division

And in case marks are less than 33% Fail

Solution:

#include <iostream>

#include <string>

using namespace std;

int main(int argc, char** argv)

string stdname="Iqra Ilyas";

string stdid ="bc210412808";

int subj1= 33;

int subj2= 29;


int subj3= 90;

int subj4= 44;

int subj5= 50;

int total_marks= 500;

float avg_marks;

int obtmarks;

obtmarks= subj1+subj2+subj3+subj4+subj5;

cout<<"Student Name:"<<stdname<<endl;

cout<<"Student ID:"<<stdid<<endl;

cout<<"obtained Marks:"<<obtmarks<<"/"<<total_marks<<endl;

avg_marks=(obtmarks*100)/total_marks;

cout<<"Average Marks:"<<avg_marks<<"%"<<endl;

if(avg_marks>=60)

cout<<"Division:First";

else if(avg_marks>=45 && avg_marks<60)

cout<<"Division:Seconed";

else if(avg_marks>=33 && avg_marks<45)

cout<<"Division:Third:";

else if(avg_marks<33)
{

cout<<"Division:Fail:";

return 0;

You might also like