C# Program to find the greatest number among three numbers

In this program, You will learn how to find the greatest number among the three numbers in C#.

33 44 10 => 44

33 55 20 => 55

Example: How to find the greatest number among three numbers in C#.

using System;
public class Test
	public static void Main(string[] args)
		int x, y, z;
		Console.Write("Enter first number:");
		x = Convert.ToInt32(Console.ReadLine());

		Console.Write("Enter second number:");
		y = Convert.ToInt32(Console.ReadLine());

		Console.Write("Enter third number:");
		z = Convert.ToInt32(Console.ReadLine());

		if (x > y && x > z)
			Console.WriteLine("Greatest is:" + x);
		else if (y > z)
			Console.WriteLine("Greatest is:" + y);
			Console.WriteLine("Greatest is:" + z);



Enter first number:10
Enter second number:20
Enter third number:15
Greatest is:20

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.