mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-15 06:12:59 +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;
|
|
}
|
|
}
|