Hope this code will help you in finding solution of your problem.
Program:
using System;
class LinearEquations
{
public static void Main()
{
int response;
float a,b,c,d,m,n, temp;
double x1,x2;
EnterNewValuesAgain:
Console.WriteLine(""); // Blank Line
Console.WriteLine(" ** Linear Equation **** ");
Console.WriteLine(""); // Blank Line
// Reading the value of a
Console.Write("Enter the value of a : ");
a = float.Parse(Console.ReadLine()); // Reading the value of b
Console.Write("Enter the value of b : ");
b = float.Parse(Console.ReadLine()); // Reading the value of c
Console.Write("Enter the value of c : ");
c = float.Parse(Console.ReadLine()); // Reading the value of d
Console.Write("Enter the value of d : ");
d = float.Parse(Console.ReadLine());
temp = a*d - b*c;
if (temp == 0)
{
Console.WriteLine(""); // Blank Line
Console.WriteLine("The denominator equals to zero (0); Cannot proceed
further ...");
Console.Write("Do You want to enter new values (1 For Yes / 0 For No) ?
");
response = int.Parse(Console.ReadLine());
if (response == 0)
{
goto Exit;
}
else
{
goto EnterNewValuesAgain;
} }
else
{ // Reading the value of m
Console.Write("Enter the value of m : ");
m = float.Parse(Console.ReadLine());