IT Community - Software Programming, Web Development and Technical Support

Greatest of Three Numbers Without Using Relational Operator?

This is a discussion on Greatest of Three Numbers Without Using Relational Operator? within the C and C++ Programming forums, part of the Software Development category; Hi all, Is it possible to find out greatest of 3 numbers without using relational operators. pLeAsE hElP...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-11-2007, 11:10 PM
velhari velhari is offline
D-Web Programmer
 
Join Date: Mar 2007
Location: Chennai
Posts: 67
velhari is on a distinguished road
Send a message via AIM to velhari
Question Greatest of Three Numbers Without Using Relational Operator?

Hi all,
Is it possible to find out greatest of 3 numbers without using relational operators. pLeAsE hElP
__________________
Regards,
VELHARI
I am not totally useless. I can be used for a bad example
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-14-2007, 12:59 AM
connect2sathya connect2sathya is offline
D-Web Trainee
 
Join Date: Feb 2007
Posts: 14
connect2sathya is on a distinguished road
Default Re: Greatest of Three Numbers Without Using Relational Operator?

sorry velhari ...,
not able to understand...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-14-2007, 04:09 AM
connect2sathya connect2sathya is offline
D-Web Trainee
 
Join Date: Feb 2007
Posts: 14
connect2sathya is on a distinguished road
Smile Re: Greatest of Three Numbers Without Using Relational Operator?

i found one algorithm

is it right
int a,b,c;
if(a/b){
if(a/c){
>>>>>>>>>>a is greater<<<<<<<<<<<<<<<
}
}else if(b/c){
>>>>>>>>>>b is greater<<<<<<<<<<<<<<<
}else{
>>>>>>>>>>c is greater<<<<<<<<<<<<<<<<
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-16-2007, 11:08 PM
velhari velhari is offline
D-Web Programmer
 
Join Date: Mar 2007
Location: Chennai
Posts: 67
velhari is on a distinguished road
Send a message via AIM to velhari
Default Re: Greatest of Three Numbers Without Using Relational Operator?

Hi,
Great Man..... But here one problem occur, when i run this program.... Divide by Zero Error is occuring.... How to Prevent this...

For your info...
I given the input like this
A = 9
B = 0
C = 1
What to do Now?
__________________
Regards,
VELHARI
I am not totally useless. I can be used for a bad example
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-25-2007, 03:10 AM
Jimi Jimi is offline
D-Web Trainee
 
Join Date: Oct 2007
Posts: 4
Jimi is on a distinguished road
Thumbs up Re: Greatest of Three Numbers Without Using Relational Operator?

Hi,

Please put additional check for value if it is 0 or not.

Like :
if( b )
{
if( a / b )
{
..............
}
}

So, it will not give divide by zero error.

Regards,
Jimi
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating Numbers ragavraj PHP Programming 1 11-07-2007 07:12 AM
Add two numbers without using addition operator Murali C and C++ Programming 0 10-31-2007 08:15 AM
Greatest of Three Numbers Without Using Two Variable Murali C and C++ Programming 1 10-29-2007 10:50 PM
What is your greatest fear? KHyuga The Lounge 11 03-14-2007 10:53 AM
Your Greatest Regret? KHyuga The Lounge 0 02-23-2007 09:38 AM


All times are GMT -7. The time now is 09:37 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0