Created
May 28, 2017 11:26
-
-
Save sanket143/d10dd32cb0f957d5962a6e9e8fd6ab13 to your computer and use it in GitHub Desktop.
To calculate percentage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var marks = []; | |
var total = 0 ; | |
function Calculate(marks) { | |
for(i=0; i < marks.length ; i++) { | |
total = total + marks[i]; | |
var percentage = total/marks.length ; | |
} return percentage; | |
} | |
Calculate([97,93,94]) ; // here comes your marks | |
// no matter the number of subjects, its Auto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment