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
Project Description: Specifically i need develop one web based application which have student registration and according to semester and each time it will change as per semester

The Problem with finalize is that the garbage collection has to make 2  rounds in order to remove the  objects which have finalize methods. The figure below will make things cle

Site minder Authentication in SharePoint We have fit site minder agent in SharePoint 2010. We would like to have incorporate with site minder agent. Currently site-minder age

Urgently seeking a senior Extjs developer with strong NET developing skill Project Description: Urgently seeking a senior Extjs developer with strong NET developing skill

what are major difference between classic ADO &ADO.NET?

Why isn''t there an allowed amount for nonfacility for code 27405?

how to write a postfix expression calculator program using c#

What are value types and reference types?  Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort. Value types are

WP7 get data from public API with XML or JSON Project Description: Hello, I'm seeking someone who knows his way around using an API with XML or JSON output in a windows phone

Consuming a web service with SOAP on c# .NET Project Description: I need to consume a web service with SOAP. I have xml file and some description. I need it to be done