G
G
Gotem2018-08-04 11:58:43
Bots
Gotem, 2018-08-04 11:58:43

How to make the telegram bot answer with an already calculated number with percentages?

How to make the bot able to calculate the percentage of the amount on its own, without the participation of the owner? For example, the user wants to know what the amount will be if 12℅ is added to 567. The example below shows what I want to do but I can't figure it out.
The user writes: 678 The
bot replies with the already calculated amount: 759.36
How to teach the bot to calculate the percentage? Tell me, please, who knows.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Artem Spiridonov, 2018-08-04
@customtema

Part divided by the whole and multiplied by 100 - will be a percentage.
To increase the amount by N percent, you need to multiply it by 1 + n, where n is the desired number of percent divided by 100.
https://en.wikipedia.org/wiki/%D0%9F%D1%80%D0%BE %D...

R
Rsa97, 2018-08-04
@Rsa97

The first option is fantastic. Learn how to calculate percentages. Learn how to write bots for Telegram. Write a bot that calculates percentages.
Option two, realistic. Hire a developer to write a Telegram bot that calculates percentages.

D
Dmitry Bashinsky, 2018-08-04
@BashkaMen

number += number * percent / 100

S
Sergey Sokolov, 2018-08-04
@sergiks

Even Google knows how to calculate percentages:
a search query of 678 + 12% will give you the right answer:
At worst, WolframAlpha artificial intelligence can also help.
Once these somehow worked out, you can definitely handle it.
To get help in more detail, indicate in the question how you implemented the bot itself, what language you write in, and other technical pasta that may be relevant here. And, if possible, correct the grammar, please.

O
Oleg, 2018-08-04
@slayez

678 * 1.12

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question