home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day05
/
returns.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-04-14
|
438b
|
29 lines
/* Demonstrates using multiple return statements in a function. */
#include <stdio.h>
int x, y, z;
int larger_of( int a, int b);
int main( void )
{
puts("Enter two different integer values: ");
scanf("%d%d", &x, &y);
z = larger_of(x,y);
printf("\nThe larger value is %d.", z);
return 0;
}
int larger_of( int a, int b)
{
if (a > b)
return a;
else
return b;
}