Home » ASP.NET » The C# method uses 0007

The C# method uses 0007

C# method using 0007, there is a friend in need of reference.


FindMax number method
using System;
namespace CalculatorApplication
{

class NumberManipulator
{

public, int, FindMax (int, num1, int, num2)
{
//local variable declaration
int result;
If (num1 > num2)
{
return num1;
}
else
return num2;
return result;
}
static void Main (string[] args)
{
//local variable declaration
int a = 100;
int B = 200;
int ret;
NumberManipulator n = new, NumberManipulator ();
RET = n.FindMax (a, B);
Console.WriteLine (, Max, value, is, {0}, , RET);
Console.ReadLine ();
}
}
}

output:

Max value is: 200




Recursive Method Call
using System;
namespace CalculatorApplication
{

class NumberManipulator
{

public int factorial (int Num)
{
//local variable declaration
int result;
If (num==1)
{
return 1;
}
else
Result= factorial (num-1) *num;
return result;
}
static void Main (string[] args)
{
NumberManipulator n = new, NumberManipulator ();
Console.WriteLine (, Factorial, of, 6, is, {0}, , n.factorial (6));
Console.ReadLine ();
}
}
}

Factorial of 6 is: 720




using System;
namespace CalculatorApplication
{

class NullablesAtShow
{

static void Main (string[] args)
{
int = num1 = null;
double = num2 = 24;
double = Num3 = new double ();
double = num4 = 3.1415;
bool = boolval = new bool?;
// display the values
Console.WriteLine (, Nullables, at, Show:, {0}, {1}, {2}, {3}, , num1, num4, num2, Num3);
Console.WriteLine (, A, Nullable, Boolean, value:, {0}, , boolval);
Console.ReadLine ();
}
}
}

Latest