import cs1.Keyboard; public class SumFirst { public static int sumfirst(int n) { if (n<2) return n; else return n + sumfirst(n-1); } public static void main(String[] args) { System.out.println("This program sums the first n integers."); System.out.println("Enter the number n."); int n = Keyboard.readInt(); if (n < 0) System.out.println("Error: n must be a positive integer."); else System.out.println("The sum of the first n integers is " + sumfirst(n)); } }