Question: The following Code should read the first and the second number of the student ID then print the sum and divide it by zero if
The following Code should read the first and the second number of the student ID then print the sum and divide it by zero if possible. However, there are three errors in the code. Find each error and specify its type (syntax, runtime, or logic) and correct them in the bellow table. Then, write the code after you correct all errors and provide screenshot of the output.
Note:
1.The correct code should be tested using your first two numbers of your student ID.
2.Your answer should have the code as text as well as the screenshot of the program output (using your own student ID) as a part of your answer. Otherwise, zero marks will be awarded.
import java.util.Scanner;
public class Main {
public static void main(String[] Strings) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the first number of your student ID: ");
int number1 =input.nextInt();
Systm.out.println("Enter the second number of your student ID: ");
int number2 =input.nextInt();
System.out.println("The sum of two two numbers is " + number1+number2);
System.out.println("The sum devided by Zero is: " + (number1+number2)/0);
}
}
Error Type Correction
Step by Step Solution
3.45 Rating (158 Votes )
There are 3 Steps involved in it
Steps Step 1 of 3 Sure I can explain the steps to correct the errors in the given code Here are the ... View full answer
Get step-by-step solutions from verified subject matter experts
