Assignemnt #67 Adding Values in a Loop

Code

    ///Name: Prooz Fereydouni
    ///Period: 7
    ///Project Name: Adding Values in a Loop
    ///File Name: AVL.java
    ///Date: 1/7/2016
  
import java.util.Scanner;

public class AVL
{
    public static void main( String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
        int a, b=0;
        System.out.println("I will add up the numbers you give me.");
        System.out.print("Number: ");
        a = keyboard.nextInt();
        
        while(a != 0)
        {
            b += a;
            System.out.println("The total so far: " + b);
            System.out.print("Number: ");
            a = keyboard.nextInt();
        }
        System.out.println("The total is: " + b);
    }
}



    

Picture of the output

assignment67