Created
November 5, 2013 10:56
-
-
Save Codeplaza/7317316 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #define CHAR_BIT 8 | |
| /*Function to find minimum of x and y*/ | |
| int min(int x, int y) | |
| { | |
| return y + ((x - y) & ((x - y) >> | |
| (sizeof(int) * CHAR_BIT - 1))); | |
| } | |
| /* Function to find minimum of 3 numbers x, y and z*/ | |
| int smallest(int x, int y, int z) | |
| { | |
| return min(x, min(y, z)); | |
| } | |
| int main() | |
| { | |
| int x = 12, y = 15, z = 5; | |
| printf("Minimum of 3 numbers is %d", smallest(x, y, z)); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment