i am making a module in vb.net which will convert number of grams to number of tola masha and ratti respectively.
1 tola = 12 masha
1 masha= 8 ratti
while
1 tola = 12.5 grams
i can make number of tolas by number of grams \ 12.5
but can go any further.

Recommended Answers

All 3 Replies

The first step is represent every type you want to convert as Tola. Doing this you get a table like this:

Grams = 12.5
Tola = 1
Masha = 12
Ratti = 20

form this a simple formula will convert from any type to any type. Convert to quantity to tola, (Quantity / From Unit Factor), then convert this to another unit ,* To Unit Factor,

(Quantity / From Unit Factor) * To Unit Factor

For example to convert 10 Ratti to Grams. The Quantity is 10, The Unit Factor for Ratti is 20 and the Unit Factor for Grams is 12.5. (10/20)*12.5 = 6.25 Grams.

tola = grams/12.5
masha = (grams/12.5)/12 or tola/12
ratti = ((grams/12.5)/12)/8 or masha/8

thanx both of u got the idea.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.