Skip to Content
0
Former Member
Jul 05, 2012 at 10:26 AM

Regarding one formula

14 Views

Hi,

I have written one program , in which one place i get month number like 6 for june and 7 for july, and then i have to convert this in quarter number.

Basically we have divided year in 4 quarter.

So I have written this formula:

lv_temp6 = ( lv_temp6 - 1 ) / 3 + 1.

Where lv_temp6 = month value like 6 for june and 7 for july.

But when i execute this formula for june month means 6 number, it gives 3 value, but it should be 2. When i debugged code, then it was found that

lv_temp6 =(6-1)/3+1.

= 5/3 +1

= 1.667 +1.

= 2+1 = 3

I have declared lv_temp6 as a int.

So please tell me how can we get 2 instead of 3. Also this should be correct for another value also.

Thanks

Devesh Babu