in my code Devide method is not working it gives an error "ExceptionHandling.Program.Devide(int, int)': not all code paths return a value"
When i change public int Devide method in to void,the programe is workig , plz explain me what is the wrong with my code, im new to programming , plz help me
class Program
{
public int Devide(int a, int b)
{
try
{
int k;
k = a / b;
return k;
}
catch (DivideByZeroException e)
{
Console.WriteLine(e.Message);
}
}
static void Main(string[] args)
{
int c;
Program p = new Program();
c= p.Devide(8,0);
}
}