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

please solve

Former Member
0 Likes
642

hi all,

please solve the logic

ex:-

if A ge B

C = A - B

else

C = -(B - A)

data : a type i,

b type i,

c type i.

a = 100.

b = 99.

if a ge b.

c = a -b.

else.

c = a - b.

endif.

5 REPLIES 5
Read only

Former Member
0 Likes
626

data : a type i,

b type i,

c type i.

a = 100.

b = 99.

if a ge b.

c = a -b.

else.

c = a - b.

endif.

Read only

Former Member
0 Likes
626

error.

Read only

Former Member
0 Likes
626

let A = 5 and B = 3,

here A > B

therefore, C = A - B = 5 - 3 = 2

-


let A = 3 and B = 5,

here A < B

therefore, C = -(B - A) = - ( 5 - 3 ) = - 2

Read only

Former Member
0 Likes
626

data: a type i, b type i, c type i.

a = 100.

b = 50.

if a > b.

c = a - b.

else.

c = ( ( b - a ) * ( -1 ) ).

endif.

write 😕 c.

Regards

Vasu

Read only

Former Member
0 Likes
626

thanks for the solution