Problem: Write a program in C programming language to print a statement without using 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 Method in C program to print a statement without using semicolon ‘;’

1. Method

To Print ‘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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here