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...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| 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 |
| Sponsored Links |
| |||
| 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<<<<<<<<<<<<<<<< } |
| |||
| 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 |
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |