You are on page 1of 1

-1-2012)Write a C# Program to nd the maximum and minimum element in double array of 40

elements.

Solution:
double[] nums={1500.1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0.5,18,19,20,21,22,23,24,
150.4,26.7,27.8,180.9,29,30,31,32,99,110.10,110.11,36,37,38,39,90};
Array.Sort(nums);
System.Console.WriteLine("Maximum= " + nums[39]);
System.Console.WriteLine("Minimum= " + nums[0]);
Console.Read();

-1-2012) Write a C# method to multiply tow integer,double numbers by using


Overloading technique.
Solution:
static int mul(int x,int y)
{
return (x*y);
}
static double mul(double m, double n)
{
return (m*n);
}
static void Main(string[] args)
{
int a;
double b;
int x = 2,y = 4;
double m=2.5,n=2.2;
a=mul(x,y);
b=mul(m,n);
Console.WriteLine(a);
Console.WriteLine(b);
Console.Read();

You might also like