Skip to main content
added 11 characters in body
Source Link

C (clang), 6363 42 bytes

main(i){scanf("%i",&i);if(i==0)puts("1");else{printf;printf("%i",i?:1);}}

Try it online!Try it online!

Much readable than C answers that already exists here. An if-else statement whether to output 1 or the other.

Thanks to ceilingcat for golfing 21 bytes.

C (clang), 63 bytes

main(i){scanf("%i",&i);if(i==0)puts("1");else{printf("%i",i);}}

Try it online!

Much readable than C answers that already exists here. An if-else statement whether to output 1 or the other.

C (clang), 63 42 bytes

main(i){scanf("%i",&i);printf("%i",i?:1);}

Try it online!

Much readable than C answers that already exists here. An if-else statement whether to output 1 or the other.

Thanks to ceilingcat for golfing 21 bytes.

Source Link

C (clang), 63 bytes

main(i){scanf("%i",&i);if(i==0)puts("1");else{printf("%i",i);}}

Try it online!

Much readable than C answers that already exists here. An if-else statement whether to output 1 or the other.