import java.util.Scanner; public class Count{ public static void main(String[] args){ Scanner k = new Scanner(System.in); System.out.print("Number: "); int num = k.nextInt(); int totNum = 0; for(int i = 1; i <= num; i++){ totNum += i; System.out.print(i + " "); } System.out.println("The sum is " + totNum + "."); } }