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 159 views
1 answer 245 views
2 answers 480 views
2 answers 316 views
1 answer 225 views
1 answer 314 views
314 views asked Oct 6, 2020 by avibootz
1 answer 245 views
...