addition - Add Problems In java -


I want input of two variables in the form of two variables Ans will be stored in another variable, the program will repeat after each additional expiration And ask for all types of preferences for the user and add it again.

My question is how can I add all the ads again:

Exm:

  input = 5 input B = 5 ans = 10   

Egene program

  will ask for input = 6 input b = 6 ans = 12   

now How can I take all "ans" values ​​along with the program and in addition to all the "ans"

  last reply = 10 + 12 = 22   

code :

  import java.io. *; Import java.util.Scanner; Public class math {add public zeroes () {scanner keyboard = new scanner (System.in); Int a; Int b; System.out.print ("Write \ n one:"); A = keyboard.nextInt (); System.out.print ("Enter B:"); B = keyboard.nextInt (); Int c = a + b; System.out.println ("\ nans:" + c); Mathematics ob_m = new math (); Ob_m.add (); } Public static zero main (string rule []) {mathematics ob_main = new math (); Ob_main.add (); }}   

The code does just one after the other, but I want it to do one more thing ....

All this add-ins reset Too. How can I do this?

  import java.io. *; Import java.util.Scanner; Public class test {int a; Int b; Int sum = 0; Add Public Zero () {Scanner Keyboard = New Scanner (System.in); System.out.print ("Write \ n one:"); A = keyboard.nextInt (); System.out.print ("Enter B:"); B = keyboard.nextInt (); Yoga = Yoga + (A + B); System.out.println ("\ nans is:" + (a + b)); } Public static zero main (string agr []) {test ob_main = new test (); While (true) {ob_main.add (); }}}    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -