# grams to tola masha and ratti conversion

Page 1 of 1

## 7 Replies - 74344 Views - Last Post: 22 May 2013 - 12:11 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=321588&amp;s=86a425284116845f2d85c219e4eeffb0&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 zaki khan

Reputation: 0
• Posts: 13
• Joined: 22-May 13

# grams to tola masha and ratti conversion

Posted 22 May 2013 - 12:08 AM

i am writing a small piece of code in vb.net which will convert grams to tola masha and ratti respectively.
i can convert grams into number of tolas by number of grams divided by 12.5 but further i am stuck. here are some clues
1 tola = 12 masha
1 masha= 8 ratti
while in grams
1 tola=12.5grams.
Is This A Good Question/Topic? 0

## Replies To: grams to tola masha and ratti conversion

• MrCupOfT

Reputation: 2298
• Posts: 9,535
• Joined: 29-May 08

## Re: grams to tola masha and ratti conversion

Posted 22 May 2013 - 12:18 AM

It just simple maths
If i have 24 masha how many tola is that?
How many ratti do you need to make 1 tola?

### #3 x-logan

Reputation: 15
• Posts: 88
• Joined: 18-April 13

## Re: grams to tola masha and ratti conversion

Posted 22 May 2013 - 12:30 AM

Yeah. i Even think this is a simple calculation.

Quote

for tola
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola

for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha

fo ratti

1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti

put them in different button click event.

This post has been edited by x-logan: 22 May 2013 - 12:44 AM

### #4 zaki khan

Reputation: 0
• Posts: 13
• Joined: 22-May 13

## Re: grams to tola masha and ratti conversion

Posted 22 May 2013 - 01:08 AM

x-logan, on 22 May 2013 - 12:30 AM, said:

Yeah. i Even think this is a simple calculation.

Quote

for tola
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola

for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha

fo ratti

1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti

put them in different button click event.

### #5 zaki khan

Reputation: 0
• Posts: 13
• Joined: 22-May 13

## Re: grams to tola masha and ratti conversion

Posted 22 May 2013 - 01:14 AM

x-logan, on 22 May 2013 - 12:30 AM, said:

Yeah. i Even think this is a simple calculation.

Quote

for tola
suppose
2 tola = 2 *12.5g = 30gram
1gram = (2/30) or (1/12.5) tola

for masha
suppose
1 masha = (1/12)*1*12.5 = approx (1.041)gram
1 gram = (1/1.041)masha

fo ratti

1 ratti = (1/8)*(1/12)*1*12.5 = approx 0.13 gram
or 1 ratti = 1*(1.041/8) = .13 gram
1 gram = (1/.13)ratti

put them in different button click event.

well i have correct a small mistake in calculation. thanks for the idea. actually i have a text box in which client will input the number of grams. suppose the gold weighs 111 grams. now i want to converts this weight into tola masha and ratti.

for tola: 111\12.5
i will get only the integral part that is 8. means 8 tolas.

for masha and ratti: i have remaining 11 grams now thats what in which i am stuck. i a single click he will know how much tolas mashas and rattis 111gram have.

### #6 x-logan

Reputation: 15
• Posts: 88
• Joined: 18-April 13

## Re: grams to tola masha and ratti conversion

Posted 22 May 2013 - 02:38 AM

okay i got you.

take six textboxes and one button. this is simplest way. you can do much better. this is just an idea how calculation goes.
1. for input(grams)
2. for tola
3. for masha
4. for ratti
5. for ist remainder
6. for 2nd remainder

``` Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
TextBox2.Text = Math.Truncate(TextBox1.Text / 12.5) ' this will gives you tola in (textbox2)
TextBox5.Text = (TextBox1.Text Mod 12.5) ' ist remainder
TextBox6.Text = (TextBox5.Text Mod 1.0417) ' 2nd remainder
TextBox3.Text = Math.Truncate(TextBox5.Text / 1.0417) ' this will gives you masha in (textbox3)
TextBox4.Text = Math.Truncate(TextBox6.Text / 0.13) ' this will gives you masha in (textbox4)
Catch
End Try
End Sub
```

### #7 kai_itz me

Reputation: 28
• Posts: 159
• Joined: 03-August 12

## Re: grams to tola masha and ratti conversion

Posted 22 May 2013 - 02:58 AM

maths.truncate will do the Job
The above code working for me.

But I will suggest you to use variables instead of taking too many textboxes. for example textbox5 as A, textbox6 As B,

```Dim A, B As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
TextBox2.Text = Math.Truncate(TextBox1.Text / 12.5) ' this will gives you tola in (textbox2)

A = (TextBox1.Text Mod 12.5) ' ist remainder
B = (A Mod 1.0417) ' 2nd remainder

TextBox3.Text = Math.Truncate(A / 1.0417) ' this will gives you masha in (textbox3)
TextBox4.Text = Math.Truncate(B / 0.13) ' this will gives you Ratti in (textbox4)

Catch
End Try
```

This post has been edited by kai_itz me: 22 May 2013 - 03:21 AM

### #8 zaki khan

Reputation: 0
• Posts: 13
• Joined: 22-May 13

## Re: grams to tola masha and ratti conversion

Posted 22 May 2013 - 12:11 PM

thank u so much guys. that work like charm.