Ques:
A student will not be allowed to sit in exam if his/her attendence is less than 75%. Take following input from user Number of classes held Number of classes attended. And print percentage of class attended Is student is allowed to sit in exam or not.
MY_solution :
int main()
{
int nca;
int nch;
int pattend;
cout << "Enter no. of classes held : " << endl;
cinnch;
cout << "Enter no. of classes attended : " << endl;
cinnca;
pattend = (nca / nch * 100);
cout << "Percentage attendence : " << pattend << endl;
if (pattend = 75) {
cout << "Allowed to Give EXAMS :) " << endl;
}
else {
cout << "NOT ALLOWED! Wasted" << endl;
}
}
My_output:
**Enter no. of classes held : 100
Enter no. of classes attended : 50
Percentage attendence : 0
NOT ALLOWED! Wasted**
I'm not getting percentage attendance correct .