I am writing a program where student input their name, Id, and five subjects marks, after that out put showing the average percentage of the subjects, but when i divide obtained marks by total marks output is showing zero.
This is my code. i coloured the code with blue font which is making trouble.
#include <iostream>
using namespace std;
int main() {
// Input Name from student
string Nm;
cout << "Enter Your First Name: ";
cin >> Nm;
//Input VUID from student
string VUID;
cout << "Enter Your VUID: ";
cin >> VUID;
int Science =100, Maths=100, SST=100, Computer=100, Accounting=100, TtlMrks,Avg;
int AllSubMrks=Science+Maths+SST+Computer+Accounting;
cout << "Enter Science Marks: "; // Type a number and press enter
cin >> Science; // Get user input from the keyboard
cout << "Enter Maths Marks: "; // Type a number and press enter
cin >> Maths; // Get user input from the keyboard
cout << "Enter SST Marks: "; // Type a number and press enter
cin >> SST; // Get user input from the keyboard
cout << "Enter Computer Marks: "; // Type a number and press enter
cin >> Computer; // Get user input from the keyboard
cout << "Enter Accounting Marks: "; // Type a number and press enter
cin >> Accounting; // Get user input from the keyboard
cout << "Student Name: " << Nm <<"\n";
cout<< "Student VUID: " << VUID<<"\n";
TtlMrks = Science+Maths+SST+Computer+Accounting;
cout << "Obtain Marks: " <<TtlMrks<<"/"<<AllSubMrks<<"\n";
Avg = TtlMrks/AllSubMrks;
Avg=Avg*100;
cout <<"Average Marks:"<<Avg <<"\n";
if (TtlMrks> 60) {
cout << "Division: First";
} else if (TtlMrks>=45 && TtlMrks<=60) {
cout << "Division: Second";
}
else if (TtlMrks>=33 && TtlMrks<=45) {
cout << "Division: Second";
} else if (TtlMrks<33) {
cout << "Division: Fail";
}
return 0;
}