This piece of code shows exception:
Exception in thread "main" java.lang.ArithmeticException: / by zero
at Ankit2.main(Ankit2.java:6)
Why and how its happening? Without using try and catch block?
class ankit1
{
public static void main(String args[])
{
float a=20,b=120,c=50,sum;
sum=(a+b+c)/0;
System.out.println("The average of three number is:"+sum);
}
}