• Source
    1. //code by http://CppQA.blogspot.com
    2. //we are community of developers focusing on help for new programmers
    3. #include <iostream>
    4. using namespace std;
    5. #define CHAR_BIT 8
    6.  
    7. /*Function to find minimum of x and y*/
    8. int min(int x, int y)
    9. {
    10. return x + ((y - x) & ((y - x) >>
    11. (sizeof(int) * CHAR_BIT - 1)));
    12. }
    13.  
    14. /* Function to find minimum of 3 numbers x, y and z*/
    15. int smallest(int x, int y, int z)
    16. {
    17. return min(x, min(y, z));
    18. }
    19.  
    20. int main()
    21. {
    22. int x = 1, y = 100, z = 90;
    23. cout << "Minimum of 3 numbers is " << smallest(x, y, z) << endl<<"http://CppQA.blogspot.com"<<endl;
    24. return 0;
    25. }