How to add two numbers in Groovy

2 Answers

0 votes
def x = 5
def y = 8

print 'x + y = ' + (x + y)



/*
run:

x + y = 13

*/

 



answered Sep 28, 2020 by avibootz
0 votes
int a = 23;
int b = 912; 
 
printf "%d + %d = %d\n", a, b, a + b
 


/*
run:

23 + 912 = 935

*/

 



answered Sep 29, 2020 by avibootz

Related questions

1 answer 157 views
1 answer 241 views
2 answers 476 views
2 answers 309 views
1 answer 217 views
1 answer 310 views
310 views asked Oct 6, 2020 by avibootz
1 answer 240 views
...