15,744,193 members
See more:
hi
I wanna calculate ratio in 3:2 form and to store its flag value and result ina database.and i have 2 textboxes wherein we enter ratio i.e.,3:2.

Now how to calculate (Tot_share/3)*2 and also if the result contain decimal value then flag value should be 'Y' Otherwise 'N'.

Here in the example we have (Tot_share/3)*2=(300/3)*2=100*2=200 since it doesnt contain decimal its flag value is N(i.e., No) and these values should be stored in a database table when i click the submit button.

For ex:

Tot_share Result FlagValue
300 200 N

Any help would be appreciated..
Posted
Updated 29-Apr-12 18:37pm
v2

## Solution 1

First of all, based on what you have to do, tagging it as ASP.NET is irrelevant. Steps to do:
1. Take input - ratio
2. Take input - total share
3. Apply simple maths and get the share A & share B based on ratio
4. Using a simple 'if' and a '%' modulus operator see if it is a whole number or decimal
5. Flag based on value
6. Connect to DB
7. Pass the flag value to DB for storage.

Try!

If you get stuck and need help, share what you tried and be specific with your issue. Surely one will help you out.

## Solution 2

hi
Its fine but how can i write stored procedure for the above..