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. Modify the question to allow student to sit if he/she has medical cause. Ask user if he/she has medical cause or not ( 'Y' or 'N' ) and print accordingly.
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
cout << "Enter the number of classes held: ";
float cls;
cin >> cls;
cout << "Enter the number of classes you have attended: ";
float present;
cin >> present;
float attendance;
attendance = present / cls;
if (attendance>=0.75)
{
cout << "You can sit in the exam\n";
}
if (attendance<0.75 )
{
cout << "Do you have a medical report(Y/N)" << "\n";
char medical;
cin >> medical;
if (medical == 'Y' || attendance>=0.75)
{
cout << "You can sit in the exam\n";
}
else
{
cout << "You cannot sit in the exam\n";
}
}
return 0;
}