Another interesting question is how can a semicolon be printed without using any semicolon in the program. Here are methods to print “;” :
- Using printf / putchar in if statement:
// CPP program to print// ; without using ;// using if statement#include <stdio.h>intmain(){// ASCII value of semicolon = 59if(printf("%c\n", 59))if(putchar(59)){}return0;}chevron_rightfilter_noneOutput:
; ;
We can also print the semicolon using switch/ while / for as illustrated in this article.
- Using macros :
// CPP program to print// ; without using ;// using macros#include <stdio.h>#define GEEK printf("%c",59)intmain(){if(GEEK){}}chevron_rightfilter_noneOutput:
;
Related article: Print Hello World without semicolon in C/C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- Print Hello World without semicolon in C/C++
- C Program to print numbers from 1 to N without using semicolon?
- C/C++ program to print Hello World without using main() and semicolon
- Write a C program to print "Geeks for Geeks" without using a semicolon
- Role of SemiColon in various Programming Languages
- Program to print Hut
- How to print a variable name in C?
- How to print % using printf()?
- Program to print DNA sequence
- How will you print numbers from 1 to 100 without using loop? | Set-2
- Print the given pattern recursively
- Print the array after K operations
- Print all possible rotations of a given Array
- Program to print pattern
- Pattern to print X in a rectangular box
- Program to print the pattern 'G'
- Program to print 2D shapes
- Print the following pyramid pattern
- Program to print the pattern ‘D’
- Program to print the pattern "GFG"

