Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
733 B
2
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
    double grade1,grade2,grade3;
cout<<"Enter your 3 grades:\n";
cin>>grade1>>grade2>>grade3;

if((grade1<56)&&(grade2<56)&&(grade3<56))
{
    cout<<"Failed!\n";
}

if((grade1>=56)&&(grade2>=56)&&(grade3>=56))
{
    cout<<"The average is:\n"<<(grade1+grade2+grade3)/3;
}

if((grade1>=56)&&(grade2>=56)&&(grade3<56))
{
    cout<<"The average is:\n"<<(grade1+grade2)/2;
}

if((grade1<56)&&(grade2>=56)&&(grade3>=56))
{
    cout<<"The average is:\n"<<(grade2+grade3)/2;
}

if((grade1>=56)&&(grade2<56)&&(grade3>=56))
{
    cout<<"The average is:\n"<<(grade1+grade3)/2;
}

else
{
    cout<<"The average cannot be calculated\n";
}

return 0;
}