using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
// Download Code
public delegate void del(int a, int b);
class pro
{
public static void add(int x, int y)
{
int c = x + y;
Console.WriteLine("Addition is:" + c);
}
public static void sub(int x, int y)
{
int c = x - y;
Console.WriteLine("Subtraction is:" + c);
}
public static void mul(int x, int y)
{
int c = x * y;
Console.WriteLine("Multiplication is:" + c);
}
public static void div(int x, int y)
{
try
{
int c = x / y;
Console.WriteLine("Division is:" + c);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
class Program : pro
{
public static string vh;
static void Main(string[] args)
{
do
{
Console.WriteLine("enter the first no");
int x = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter the second no");
int y = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter 1 for addition");
Console.WriteLine("enter 2 for substraction");
Console.WriteLine("enter 3 for multiplication");
Console.WriteLine("enter 4 for division");
int i = Convert.ToInt32(Console.ReadLine() + "\t");
if (i == 1 || i == 2 || i == 3 || i == 4)
{
switch (i)
{
case 1:
del d1 = new del(pro.add);
d1(x, y);
break;
case 2:
del d2 = new del(pro.sub);
d2(x, y);
break;
case 3:
del d3 = new del(pro.mul);
d3(x, y);
break;
case 4:
del d4 = new del(pro.div);
d4(x, y);
break;
}
}
else
{
Console.WriteLine("you entered a wrong no");
}
Console.WriteLine("do u want to continue");
vh = Convert.ToString(Console.ReadLine());
} while (vh.ToLower() != "no");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
// Download Code
public delegate void del(int a, int b);
class pro
{
public static void add(int x, int y)
{
int c = x + y;
Console.WriteLine("Addition is:" + c);
}
public static void sub(int x, int y)
{
int c = x - y;
Console.WriteLine("Subtraction is:" + c);
}
public static void mul(int x, int y)
{
int c = x * y;
Console.WriteLine("Multiplication is:" + c);
}
public static void div(int x, int y)
{
try
{
int c = x / y;
Console.WriteLine("Division is:" + c);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
class Program : pro
{
public static string vh;
static void Main(string[] args)
{
do
{
Console.WriteLine("enter the first no");
int x = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter the second no");
int y = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter 1 for addition");
Console.WriteLine("enter 2 for substraction");
Console.WriteLine("enter 3 for multiplication");
Console.WriteLine("enter 4 for division");
int i = Convert.ToInt32(Console.ReadLine() + "\t");
if (i == 1 || i == 2 || i == 3 || i == 4)
{
switch (i)
{
case 1:
del d1 = new del(pro.add);
d1(x, y);
break;
case 2:
del d2 = new del(pro.sub);
d2(x, y);
break;
case 3:
del d3 = new del(pro.mul);
d3(x, y);
break;
case 4:
del d4 = new del(pro.div);
d4(x, y);
break;
}
}
else
{
Console.WriteLine("you entered a wrong no");
}
Console.WriteLine("do u want to continue");
vh = Convert.ToString(Console.ReadLine());
} while (vh.ToLower() != "no");
}
}
}
// Made by Kalyani
0 comments:
Post a Comment