Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

value calculation

Former Member
0 Kudos

Hi All,

Please help me,

data : a(4) type n,

b(4) type n,

c type f.

a = 185.

b = 42.

c = a / b.

  • ceal c.

write 😕 c.

if ‘c’ value is 15.38, I want round that value i.e 16.

Thanks and regards,

Amjad Hussain,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI

data: l_1 type i, l_2 type p decimals 2.

l_2 = '1.78'.

l_1 = FLOOR( l_2 ).

l_1 = l_1 + 1.

write: l_1.

OR

use Function ceil.

w_qty = ceil( input_qty)

2)

use floor function

for example...

data: pd(5) type p decimals 2.

pd = '30.65'.

pd = ceil( pd ).

pd1 = floor( pd ).

write: pd, pd1

it will displayed as 30 and 31...

Message was edited by:

Muthurajan Ramkumar

4 REPLIES 4

former_member386202
Active Contributor
0 Kudos

Hi,

Declare c type numeric

Regards,

Prashant

Former Member
0 Kudos

HI

data: l_1 type i, l_2 type p decimals 2.

l_2 = '1.78'.

l_1 = FLOOR( l_2 ).

l_1 = l_1 + 1.

write: l_1.

OR

use Function ceil.

w_qty = ceil( input_qty)

2)

use floor function

for example...

data: pd(5) type p decimals 2.

pd = '30.65'.

pd = ceil( pd ).

pd1 = floor( pd ).

write: pd, pd1

it will displayed as 30 and 31...

Message was edited by:

Muthurajan Ramkumar

Former Member
0 Kudos

Hi

Try

data : a(4) type n,

b(4) type n,

c type f,

d type i.

a = 2185.

b = 42.

c = a / b.

  • ceal c.

d = floor( c ) + 1.

write 😕 c, d.

Former Member
0 Kudos

Hi,

try this.

data a(4) type n,

b(4) type n,

c type p.

a = 185.

b = 42.

c = a / b.

write : / c.

declare c as packed type .

reward if useful.