Assignment 67 and Addingv
Code
///Matthew Hughs
///Period 5
///Addingv
///Addingv.java
///1/5/2016
import java.util.Scanner;
class Addingv
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
int total;
System.out.println("I will add up the numbers you give me.");
System.out.print("Number ");
int x = keyboard.nextInt();
total = x;
System.out.println("The total right now is " + total);
while (x != 0)
{
System.out.print("Number : ");
x = keyboard.nextInt();
total = (x + total);
System.out.println("The total right now is " + total);
}
System.out.println("Your total is " + total);
}
}
Picture of the output