You have to create a algo like:
Step1: devide value/100 and get output value and rest value
step1.1: if rest value is zero than minus 100 from orignal value and minus 1 from quotient
step1.2: now simple 100 rs: minus 1 from quotient
50rs=1
10=5
step2: if rest value is not zero than check it divisible by 50 or not, if yes it is fully divisible by 50 than again 50 minus from rest value and 1 minus from quotient
and so on:
Example:
if your value is 780
step 1: devide it by 100 780/100
quotient_100=7
restValue=80
now devide restValue/50 i.e. 80/50
quotient_50=1
restValue=30
now devide restValue/10 i.e. 30/10
quotient_10=3
rest value =0
so Rs are 100=7 (quotient_100),
50=1 (quotient_50),
10=3 (quotient_10)
another ex: value=800
1) devide by 100 800/100
quotient_100=8
and restValue =0
so if restValue is zero than take restValue=100 and quotient_100=quotient_100-1 i.e. 7
now devide restValue/50 means 100/50
quotient_50 = 2
restValue=0
so again restValue=0 so same step take restValue=50 and quotient_50=quotient_50-1=1
devide restvalue/10 means 50/10
quotient=5
restvalue=0
now rs will be: 100=7
50=1
10=5
same as algo can be applied for any number in your application.
Thanks,
Rajni Shekhar
0194Ca071007, if this helps please login to Mark As Answer. | Alert Moderator