#include <stdio.h>
#include <conio.h>
int clip(int lo, int x, int hi)
{
if (lo < hi)
{
& if (x < lo)
& return lo;
& if (x > hi)
& return hi;
}
return x;
}
void main()
{
printf("%d\n", clip(8, 2, 11));
printf("%d\n", clip(2, 9, 6));
printf("%d\n", clip(5, 1, 4));
printf("%d\n", clip(7, 8, 10));
getch();
}
Comments
Leave a comment