dimanche 3 avril 2016

If else statement inside another if else

I need to create a program which asks the user to enter two marks, then i have a code which adds them together to find the avarage. So the question is how do I create an if statement that tells the user the minimum I should have get for both of the marks is 30% so even if I've got more then 40% total(which is the minimum marks to pass) I still haven't pass cause i've got less then 30% in one or both of them? Here my code:

    if  (totalMarks >= 40)
    {
        answer = true;
    }
    else
    {
        answer = false;
    }
    return answer;
}

Aucun commentaire:

Enregistrer un commentaire