#1 Find the errors in the following codes: // This code contains ERRORS! // It adds two numbers entered by the user. int num1, num2; String input; char again; Scanner keyboard = new Scanner(System.in); while (again == ‘y’ | | again == ‘Y’ ) System.out.print(“Enter a number: “); num1 = keyboard.nextInt(); System.out.print(“Enter another number: “); num2 = keyboard.nextInt(); System.out.println(“Their sum is “+ (num1 + num2)); System.out.println(“Do you want to do this again? “); keyboard.nextLine(); // Consume remaining newline input = keyboard.nextLine(); again = input.charAt(0); #2 // This code contains ERRORS! int count = 1, total; while (count



Source link

Leave a Reply

Your email address will not be published.