468,513 Members | 1,854 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

Integer Parameters

10
Write the definition of a function min that has two int parameters and returns the smaller.
Oct 11 '06 #1
2 4558
Write the definition of a function min that has two int parameters and returns the smaller.
Hey, try and do them yourself... How else are you gonna learn?...=)

int min(int a, int b){
if (a<=b) return a;
else return b;
}

Bye, I'm going to sleep...
Oct 11 '06 #2
Expand|Select|Wrap|Line Numbers
  1. int min( int x, int y) {
  2.     return x < y ? x : y;
  3. }
  4.  
Oct 12 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

14 posts views Thread by Bart Samwel | last post: by
1 post views Thread by ypul | last post: by
5 posts views Thread by Řyvind Isaksen | last post: by
21 posts views Thread by utab | last post: by
2 posts views Thread by staeri | last post: by
1 post views Thread by =?Utf-8?B?RG9u?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.