Click here to Skip to main content
15,744,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

And your issue is?

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.
 
Share this answer
 
hi
Its fine but how can i write stored procedure for the above..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900