1. Any value that comes from any form field is string by nature especially in your case you are using the value of days form field. Before using the value in a mathematical expression you need to convert the value into number using parseInt or parseFloat methods.

2. You can't call floor function the way you used. It should be like the following. The floor function comes under Math object.

Math.floor()

3. You have used a variable named 'ac' make sure that it contains number based value in it.

Assuming that you have proper value in 'ac' variable check the following CODE