Assignemnt #63 Adding Value In a Loop

Code

/// Name: JJ Deng
/// Period: 6
/// Program Name: Adding Values In a Loop
/// File Name: AddingValuesInLoop.java
/// Date Finished: 1/9/2015
  
    
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.Random;

public class AddingLoop
{
	public static void main(String[] args)
	{
		Scanner keyboard = new Scanner(System.in);

		int number, total;
        total= 0;
        
        System.out.println( "I will add numba you giv mehh." );
            System.out.print( "NUMBA: ");
            number = keyboard.nextInt();
            
            while ( number!= 0 )
            {
                total = total + number;
                System.out.println( "The total so far is " + total );
                System.out.print( "NUMBA: ");
                number = keyboard.nextInt();
            }
            
            System.out.println( "The total is " + total );
        }
    }

  

Picture of the output

Assignment 63