///Name: Ian Grant ///Period:5 ///Project Name: Adding Values with for loops ///File Name:ForAdd.java ///01/27/16
import java.util.Scanner; public class ForAdd { public static void main( String[] args ) { Scanner stuff = new Scanner(System.in); System.out.println("Number: "); int num = stuff.nextInt(); int sum=0; for (int i = 1;i<=num; i++) { sum = sum +i; System.out.print(" "+i); } System.out.println("\n The sum is "+sum+"."); } }