Assignemnt #88 and Adding Values
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Adding Values
/// File Name: AddingValues.java
/// Date Finished: 2/1/2016
import java.util.Scanner;
public class AddingValues
{
public static void main( String[] args )
{
Scanner kb = new Scanner(System.in);
int count = 0;
System.out.print("Number: ");
int n = kb.nextInt();
for ( int x = 1; x <= n; x++ )
{
System.out.print(" " + x );
count = x + count;
}
System.out.println("\nThe sum is " + count + ".");
}
}
Picture of the output