C program to print a statement without using semicolon ‘;’

4656

Problem: Write a program in C programming language to print a statement without using the semicolon ‘ ; ’.

Use of semicolon in C programming language: The semicolon is a statement terminator in C programming language to help the parser figure out where the statement ends since, by default, statements in C (and C++ as well) can have any number of lines.

Syntax of print a statement in C programming language:

            printf (“ Space to write statement in here in between these double cots ”);

Various Methods in C program to print a statement without using a semicolon ‘;’

1. Method

To Print the‘ Welcome to C programming language’ statement in C program language without using semicolon [Single time.]

#include <stdio.h>
#include <conio.h>
void main()
{
if(printf (” Welcome to C programming language. “))
{
}
getch();
}

Output:

Welcome to C programming language.

2. Method

To Print ‘It my program in C language to print world without using semicolon.’ statement in C without using semicolon [infinite times]

#include <stdio.h>
#include <conio.h>
void main()
{
while(printf (” It my program in C language to print world without using semicolon. “))
{
}
getch();
}

Output:

It my program in C language to print world without using semicolon.
It my program in C language to print world without using semicolon.
It my program in C language to print world without using semicolon.


3. Method

To Print ‘C program to print Hello world without using semicolon.’ statement in C with help of switch case.

#include <stdio.h>
#include <conio.h>
void main()
{
switch(printf (” C program to print Hello world without using semicolon. “))
{
}
getch();
}

Output:

C program to print Hello world without using semicolon.

4. Method

To print ‘Welcome to C programming’ using Else-if Ladder without semicolon.

#include <stdio.h>
#include <conio.h>
void main()
{
if(printf(“”))
{
}
else if (printf (“Welcome to C programming.”))
{
}
else
{
}
getch();
}

Output:

Welcome to C programming.

5. Method

To Print  ‘Hello’ word in C program without using Semicolon by using While and Not.

#include <stdio.h>
#include <conio.h>
void main()
{
while(!printf (“Hello”))
{
}
getch();
}

Output:

Hello

6. Method

To print a statement ‘Welcome to C programming language.’ by using #define in C programming.

#include <stdio.h>
#include <conio.h>
#define PRINT printf (“Welcome to C programming language.”)
void main()
{
if(PRINT)
{
}
getch();
}

Output:

Welcome to C programming language.

Attempt Free C Programming MCQ Quiz

Previous articleArden’s theorem examples and Conversion of finite automata to regular expression
Next articleC program to check a number is even or odd without modulus or division condition
Er Parag Verma
Hello I am Er Parag Verma. I am tech blogger, Professor and Entrepreneur. I am on the mission to change the pattern of learning to make it easy, valuable and advance.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.