import java.util.Scanner; public class AddLoop { public static void main( String[] args ) { Scanner keyboard = new Scanner(System.in); int s, x; s=0; System.out.println(" number: " ); x = keyboard.nextInt(); for ( int n = 1 ; n <= x ; n = n+1 ) { System.out.println( n ); s=s+n; } System.out.println( " The sum is " + s ); } }