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
Program of Nested Loop - C# Program I am a learner of C# language and i am struggling with the Loops in c#. Can you have any code examples for this.

Project Description: I am looking an app that mimics this app presently available here [justremotephone.com]. It has a nice set of features but also lacks a lot when it comes to

What are satellite assemblies? We use resource files to store data according to the localized languages. But when you actually go for the deployment you will not like to also i

Problem: (a) (i) Using a diagram, illustrate the basic process in an ASP.NET Architecture involving at least five objects. (ii) List two methods and two collections

Change an web Admin panel into multilingual admin panel Project Description: Hello, We have already built a admin panel where only English is the presently supported language

What is a workflow? A workflow is a collection of actions (called activities) that presents the model of a process. A workflow gives a way to explain the order of the execution

Duplicate a Website I need a customer management site Please help me out and what I need to get. I need all charteristics of above mentioned site a) Effects b) Mobil


Hello, I want to develop one crystal report. I have one database which has 5 field.One is string and others are Boolean. String field name is State and Four remaining fields are Th

Explain Dataset Accept Changes and Data Adapter Update methods?  Data Adapter Update method Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated