18 lines
194 B
C
18 lines
194 B
C
|
|
int abs(int x) {
|
|
if(x < 0) {
|
|
return -x;
|
|
} else {
|
|
return x;
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
int x = rand(0,10);
|
|
int y = abs(x);
|
|
assert(y >= 0);
|
|
x = rand(-10, 10);
|
|
y = abs(x);
|
|
assert(y >= 0);
|
|
}
|
|
|