static void Main(string[] args)
{
double i, j;
Console.WriteLine("Enter fnum");
i = Convert.ToDouble(Console.ReadLine());
start:
Console.WriteLine("Enter snum");
j = Convert.ToDouble(Console.ReadLine());
if(j==0)
{
goto start;
}
Console.ReadLine();
Console.WriteLine("Div result is {0}/{1}={2}", i, j, i / j);
}
I'm trying to implement Divide by zero using GOTO in c#. I got the result but here I would like to first calculate fnum/snum and print the result and then if I enter snum zero it should ask me enter snum other than zero.Then the goto start label should start working. But here in this case I was only able to execute fnum/snum by default.
Console.WriteLine("Enter fnum");
i = Convert.ToDouble(Console.ReadLine());
start:
Console.WriteLine("Enter snum");
j = Convert.ToDouble(Console.ReadLine());
Here if I enter snum zero it should take me to start label and ask me "enter second number other zero"
Can any one help me?