Finding maximum & minimum numbers - c# program, DOT NET Programming

Finding Maximum & Minimum Numbers - C# Program

I am facing some problems in the code for Finding Maximum & Minimum Numbers. Can anybody suggest me the proper code for it.

Posted Date: 2/12/2013 12:57:52 AM | Location : United States





This code is appropriate for you, try this..

Program:

using System;

class LargestSmallest

{

public static void Main()

{

int a,b,c,largest,smallest;    

Console.Write("Enter No 1 : ");

a = int.Parse(Console.ReadLine());    

Console.Write("Enter No 2 : ");

b = int.Parse(Console.ReadLine());    

Console.Write("Enter No 3 : ");

c = int.Parse(Console.ReadLine());    

if (a > b)

{

if(a > c)

{

largest = a;

}

else

{

largest = c;

}

}

else

{

if(c>b)

{

largest = c;

}

else

{

largest = b;

}

}  

if (a < b)

{

if(a < c)

{

smallest = a;

}

else

{

smallest = c;

}

}

else

{

if(c<b)

{

smallest = c;

}

else

{

smallest = b;

}

}  

Console.WriteLine("\n\n The Largest Number = " +largest);

Console.WriteLine("\n The Smallest Number = " +smallest);

Console.ReadLine();

}

}

Posted by Aliena | Posted Date: 2/12/2013 1:00:09 AM


Related Discussions:- Finding maximum & minimum numbers - c# program, Assignment Help, Ask Question on Finding maximum & minimum numbers - c# program, Get Answer, Expert's Help, Finding maximum & minimum numbers - c# program Discussions

Write discussion on Finding maximum & minimum numbers - c# program
Your posts are moderated
Related Questions
The Performance of the viewstate varies depending on the type of server control to which it is applied. The Text Box, Label,   RadioButton,CheckBox, and HyperLink are server contro

Program for Solution of Linear Equations - C# Program Hello, I've been trying so many codes for this but those codes didn't work well. Please write a Program for solving Linea

How to Learn Dot Net Online and get online certificate ?

What are standard query operators in LINQ? The standard query operators in LINQ are the extension process that forms the LINQ pattern. These operators form an API that enables

How do we enable SQL Cache Dependency? Below are some of the steps to enable the SQL Cache Dependency:- Enable the notifications for database. Enable the notificatio

Training and placement cell Project Description: It is about placement and training cell of any college. I have made this for one college. If needed, i can modify it. Student

How can we know a state of a thread? The "ThreadState" property is used to get complete detail of a thread. The Thread can have one or a combination of status.System.Threading.

Computer programming Project Description: Solving some issues about traffic jam Skills required: C# Programming, Java, C++ Programming, PHP, Software Architecture

What is DBMS? It is a collection of programs that enables user to make and maintain a database. In other words it is general-purpose software that gives the users with the proc

Project Description: Section - Mobile Data Collection System Using the Microsoft Mobile .Net Framework or .Net Compact Framework and ASP.NET web technology develop a mobile d