how to exit telnet linux

C++
The trick here is you need to first type escape character e.g. '^]' which is 'Ctrl + ]' and then type quit to close the telnet terminal in Linux or any UNIX system.Jan 26, 2019
#Ctrl+C doesn't work, you should ctrl+] but the most easy way
#is just type "quit" and enter
quit
Source

Also in C++: