Application Development and Automation 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: 
Read only

value calculation

Former Member
0 Likes
670

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
Read only

Former Member
0 Likes
639

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
Read only

former_member386202
Active Contributor
0 Likes
639

Hi,

Declare c type numeric

Regards,

Prashant

Read only

Former Member
0 Likes
640

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

Read only

Former Member
0 Likes
639

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.

Read only

Former Member
0 Likes
639

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.