Assignemnt #88
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: valuefor Program
/// File Name: valuefor.java
/// Date Finished: 9/9/2015
import java.util.Scanner;
import java.util.Random;
public class valuefor
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
System.out.print("Number: ");
int pick = keyboard.nextInt();
int total = 0;
for ( int n = 0 ; n <= pick ; n++ )
{
System.out.print( n + " " );
total = total + n;
}
System.out.println("");
System.out.println("The total is " + total);
System.out.println("");
}
}
Picture of the output