find errors and rewrite the program include include class G8 int c1,c2: void sum(int a, int b) c1=a+b: cout<
Answers
Explanation:
Errors in the snippet
Name of the class can't be public as public is a keyword.
Argument of main function should be an array of Strings.
We cannot assign 65.45 to c as c is an int variable and 65.45 is a floating-point literal.
Variable sum is not defined.
Variable diff is not defined.
println method takes a single argument.
Corrected Program
class A //1st correction
{
public static void main(String args[]) //2nd correction
{
int a=45,b=70;
double c=65.45; //3rd correction
int sum=a+b; //4th correction
double diff=c-b; //5th correction
System.out.println(sum + " " + diff); //6th correction
}
}