MOHAMMAD_40 0 Newbie Poster

Hello,
I am new to Javascript and I am having trouble with my assignment. I was told to create a simple "Grade Calculator" using prompt boxes It was fairly easy to make this "Grade Calculator" but there is only one problem that i cannot figure out. I was told to create this "Grade Calculator" in a manner that if someone fails in a subject they fail in all subjects(No Grade) and if someone scores passing marks on all subjects they should be able to see their grade. I hope explained it correctly.
Thanks
P.S: I can only use prompt boxes and sorry for my bad grammar/punctuation.

 <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <script>

    var sub1 = parseInt( prompt("Insert Your sub1 Marks") );
    var sub2 = parseInt( prompt("Insert Your sub2 Marks") );
    var sub3 = parseInt( prompt("Insert Your sub3 Marks") );
    var sub4 = parseInt( prompt("Insert Your sub4 Marks") );
    var sub5 = parseInt( prompt("Insert Your sub5 Marks") );
    var tot = parseInt(sub1+sub2+sub3+sub4+sub5);
     var per = parseInt(((tot)/500)*100)
     alert('Total: ' + tot + ' Out Of 500');
     alert('Percentage: ' + per + '%' );
     if(sub1<=49){
     alert('Fail --NO GRADE--');
     }
     if(sub2<=49){
     alert('Fail --NO GRADE--');
     }
     if(sub3<=49){
     alert('Fail --NO GRADE--');
     }
     if(sub4<=49){
     alert('Fail --NO GRADE--');
     }
     if(sub5<=49){
     alert('Fail --NO GRADE--');
     }
     else if(per >=50 && per <60) {
     alert('Pass --D Grade--');
     }
     else if(per >=60 && per <70) {
     alert('Pass --C Grade--');
     }
     else if(per >=70 && per <80) {
     alert('Pass --B Grade--');
     }
     else if(per >=80 && per <90) {
     alert('Pass --A Grade--');
     }
     else if(per >=90 && per <100) {
     alert('Pass --A* Grade--');
     }

    </script> </body> </html>