In this tutorial you will learn about the C Program to Print a Semicolon Without Using a Semicolon and its application with practical example.
C Program to Print a Semicolon Without Using a Semicolon
In this tutorial, we will learn to create a C program that will Print a Semicolon Without Using a Semicolon in C programming.
Prerequisites
Prior to starting this tutorial, we assume that you are best aware of some basic concepts of c programming language.
- Operators in C Programming.
- Basic Input and Output function in C Programming.
- Basic C programming.
- Concepts of conditional statements.
Print a Semicolon Without Using a Semicolon.
In todays’ session, we will learn to create a program that will print a semicolon on the screen without using “;”. The semicolon is terminology for completing every statement in the c programming language. The semicolon is used for ending loops and conditional statements.
However, we won’t be using the “;” in the print statement.
With the help of this program, we can Print a Semicolon Without Using a Semicolon.
Algorithm:-
1 2 3 4 5 6 7 |
1. Include the header files 2. Define a ascii value for semi colon to a variable 3. Print using method. 4. End |
Program to Print a Semicolon Without Using a Semicolon:-
Method type 1 to print a semicolon.
1 2 3 4 5 6 7 8 9 10 |
#include <stdio.h> int main(void) { //prints the character with ascii value 59, i.e., semi colon if (printf("%c ", 59)) { //prints semi colon } return 0; } |
Method type 2 to print a semicolon.
1 2 3 4 5 6 7 8 9 10 |
#include <stdio.h> // 59 is an ASCII value of the semicolon #define SEMICOLON 59 int main() { //Printing semi colon while (!printf("%c", SEMICOLON)) {} } |
Output:-
Printing the semicolon.
Method 1 for printing the semicolon on the output console.
Method 2 for printing the semicolon on the output console.