# Math division in nighbot

i was hoping someone could tell me how to make a command where nighbot will do multiplication
for exapmle , when one types; !maths 20 1080 . it replies" 54 is the average of a division by 20"
its simple math but i dont want there to be a sign like (*) to be there
highly appreciated

Hey so you want a command specifically for division? If so I need to know what you want done with remainders and stuff. Or is there some other way to tell what math function that you want to do?

Also side note if you make a topic please don’t private message that same topic to someone.

yes , i would like the command to be ONLY for division, the remainders should be closest to 2 decimal places eg. 1234 divided by 22 is 56.0909 , i would ike it to be 56.09 .
also i apologize for the PM , shall keep that in mind for the future, again highly appreciated sir

Ok so rounded to the nearest two decimal places should I make it so the higher number is always divided by the lower or you want specific input order? I just wanna clarify this first

i would like it to be the specific input order

Ok I’m going with the example you gave at the beginning divider first dividee second it rounds to nearest two decimals if any.

``````\$(eval N=decodeURIComponent(`\$(querystring)`).split(` `);isNaN(parseInt(N[0]))?N1=1:N1=parseInt(N[0]);isNaN(parseInt(N[1]))?N2=1:N2=parseInt(N[1]); Math.round(((N2/N1)+Number.EPSILON)*100)/100)
``````

Btw any non number inputs will become 1 !maths 20 returns 0.05

i would like to add words in the answer like !maths 20 1000 (ans ) 50 is the answer when divided by 20.
how would i go about writing the command with said words

Just include this after the first part

``````Is the answer when divided by \$(eval N=parseInt(decodeURIComponenet(`\$(querystring \$(1))`));isNaN(N)?1:N)
``````

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.