How to convert a number into indian format

hello,
i need to convert numbers into indian format e.g. if 10000 then in indian format as 10,000 .
so i want it to display amount in indian format like above example
please help me to do this
thanks in advance
please reply as soon as possible

Hello.

You can try something like this:
If you are using c++:

int value = 10240;
string destination = “”;

int thousands = floor(value / 1000.0);
int balance = value - thousands * 1000;

destination += to_string(thousands) + “,” + to_string(balance);

If you are using javascript:

var value = 10240;
var destination;

var thousands = Math.floor(value / 1000);
var balance = value - thousands * 1000;

destination = thousands + “,” + balance;

Please not that I’m not tested this. You can play around it by yourself.

A quick google came up with

string numWithCommas = to_string(value);
int insertPosition = numWithCommas.length() - 3;
while (insertPosition > 0) {
    numWithCommas.insert(insertPosition, ",");
    insertPosition-=3;
}