There must be something else going on in your code that you haven't posted.
In this demo, the output in the alert() is 37.5
Code:
<script type="text/javascript">
function displaymember(){
var x = [1,2,3,4,5,6,7,8];
var f=3;
percent=f/x.length * 100;
alert(percent);
}
displaymember();
</script>