# Thread: simple way of comparing different integers

1. Registered User
Join Date
Jun 2014
Posts
1

## simple way of comparing different integers

hi all..

is there any easy way of comparing diff integers ? like

i have four int a=1,b=4,c=1,d=9;

and if i use if else it will be long way is there any sort ways of doing these ?

i need something like

if(a>b&&c>a&&d>a)

{

//a is greater

}

else if(b>a&&b>c&&b>c)

{

//b is greater

}

else if(a==b&&a>c&&a>d)

{

//a and b are equal

}

else if(a==b&&a==c&&a>d)

{

//a,b and c are equal

}

.

.

.etc

can anyone can help me with this please?

2. Registered User
Join Date
Jun 2014
Posts
8
This is the best method to solve and compare the integers......

3. Banned
Join Date
May 2014
Posts
1,126
Stick 'em in an array, and use Array.Sort
http://msdn.microsoft.com/en-us/libr...rray.sort.aspx

4. Member
Join Date
Jun 2014
Posts
6
Great and informative method dear.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•