Write a program to print a semicolon without using a semicolon anywhere in the program.

Note this is not a practical problem, but rather a fun and challenging exercise. It can help us to learn more about the syntax and features of C/C++ programming language, and test our creativity and problem-solving skills. We should always use semicolons where appropriate in real-world applications.

1. Using printf() or putchar() function

We can use the ASCII value of the semicolon to print a semicolon, without using a semicolon in the program. The idea is to call the printf() function inside an if conditional expression with an empty body to avoid using a semicolon. When the conditional expression is evaluated, it will print a semicolon on the console.

 
The printf() function prints the character with the ASCII value 59, which is the semicolon. We can also use the putchar() function instead of the printf() function, as shown below:

 
We can also use a while-loop if the conditional statements are not allowed in the program.

2. Using std::cout

In C++, we can easily replace printf() function with std::cout. The idea is to use the static_cast<char>(59) to convert the integer 59 to a character, which is the semicolon. For example, the following C++ code prints a semicolon without using a semicolon anywhere in the program: