function fact(x){
var factorial = 1;
for(var i = 1; i<=x; i++){
factorial = factorial * i;
}
return factorial;
function fact(x){
var factorial = 1;
for(var i = 1; i<=x; i++){
factorial = factorial * i;
}
return factorial;
}