0% found this document useful (0 votes)
48 views

How To Find The Largest of 3 Numbers: Using Namespace Class Static Void String

This document provides code to find the largest of three numbers. It defines a method that takes in three long parameters, assumes the first is largest, compares the second and third to the first, and returns the largest value. The main method calls this function and prints the result.

Uploaded by

Rajthilak24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

How To Find The Largest of 3 Numbers: Using Namespace Class Static Void String

This document provides code to find the largest of three numbers. It defines a method that takes in three long parameters, assumes the first is largest, compares the second and third to the first, and returns the largest value. The main method calls this function and prints the result.

Uploaded by

Rajthilak24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

How to find the largest of 3 numbers


using System;
namespace SimpleCodingQuestions
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(FindLargestNumber(6, 3, 9));
}
/// <summary>
/// Find the largest of three numbers
/// </summary>
/// <param name="a">first parameter</param>
/// <param name="b">second parameter</param>
/// <param name="c">third parameter</param>
/// <returns></returns>
public static long FindLargestNumber(long a, long b, long c)
{
// assume that the first value is the biggest
long biggest = a;
// check if b is the biggest
if (b > biggest)
biggest = b;
// check if c is the biggest
if (c > biggest)
biggest = c;
return biggest;
}
}
}

You might also like