Computer Science, asked by rishitabhandari0703, 1 year ago

what is the statement in Java to add 20 to the previous value of variable t

Answers

Answered by mersalkeerthi46
3

Scanner keyboard = new Scanner(System.in);

   System.out.println("i will add");

   System.out.print("number: ");

   int guess = keyboard.nextInt();

   System.out.print("number: ");

   int guess2 = keyboard.nextInt();

   while(guess != 0 && guess2 != 0)

   {    

       int sum = guess + guess2;

       System.out.println("the total so far is " + sum);

       System.out.print("number: ");

       guess = keyboard.nextInt();

       System.out.print("number: ");

       guess2 = keyboard.nextInt();

       System.out.println("the total so far is " + sum);

Similar questions