Skip to content

Instantly share code, notes, and snippets.

@STCollier
Created May 2, 2023 00:58
Show Gist options
  • Save STCollier/2b6b6707bb72fa8aa3ee084f717004b2 to your computer and use it in GitHub Desktop.
Save STCollier/2b6b6707bb72fa8aa3ee084f717004b2 to your computer and use it in GitHub Desktop.
Golfed code that converts a 10 digit number to a phone number. e.g., 1234567890 -> (123) 456-7890
main(){char s[10];scanf("%[^\n]",s);printf("(%.*s) %.*s-%.*s",3,s,3,s+3,4,s+6);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment