0
1 2 3 4 5 6= 1+2 1+2+3 1+2+3+4 .........
How to code this.next number is sum of the previous number and the recent number.in other word how to add numbers to a variable š¤ in javaš
1 Answer
+ 7
Hii Reza
You can even understand the concept from sololearn!
First of all I do like to ask you to edit your question so that it can be clear!
-----
See here in the code I have taken two integers 5 and 10 and that are stored in integer variables first and second!
Then, first and second are added using the + operator, and its result is stored in another variable sum.
Finally, sum is printed on the screen using println() function!
https://code.sololearn.com/cQK54g5g61DR/?ref=app
Hope helpsāļø