mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-19 03:25:44 +00:00
907c3cad09
Recursively.
21 lines
244 B
Plaintext
21 lines
244 B
Plaintext
int main() {
|
|
// Basic
|
|
if(x > 0) {
|
|
return x;
|
|
}
|
|
else {
|
|
return -x;
|
|
}
|
|
|
|
// if else
|
|
if(x > 0) {
|
|
return x;
|
|
}
|
|
else if(x == 0) {
|
|
return 420;
|
|
}
|
|
else {
|
|
return -x;
|
|
}
|
|
}
|