Assignment #67 Adding Values
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: AddingValues
/// File Name: AddingValues.java
/// Date Finished 12/17/2015
import java.util.Scanner;
public class AddingValues
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int total, entry;
total = 0;
entry = 1;
System.out.println( "I will add up the numbers you give me! Let's go" );
while ( entry != 0 )
{
System.out.print( "Number: " );
entry = keyboard.nextInt();
total = total + entry;
if ( entry != 0 )
{
System.out.println( "The total so far is " + total );
}
}
System.out.println();
System.out.println( "The total is " + total + "." );
}
}
Picture of the output
//