C Program to print "hello" without semicolon

C Program to print “hello” without semicolon

C Program to print “hello” without semicolon

We can print “hello” or “hello world” or anything else in C without using semicolon. There are various ways to do so:

  1. Using if
  2. Using switch
  3. Using loop etc.
Program 1: Using if statement

Let’s see a simple c example to print “hello world” using if statement and without using semicolon.

#include<stdio.h>

int main()

{

if(printf(“hello world”)){}

return 0;

}

Output:

hello world
Program 2: Using switch statement

Let’s see a simple c example to print “hello world” using switch statement and without using semicolon.

#include<stdio.h>

int main()

{

switch(printf(“hello world”)){}

return 0;

}

Output:

hello world
Program 3: Using while loop

Let’s see a simple c example to print “hello world” using while loop and without using semicolon.

#include<stdio.h>

int main()

{

while(!printf(“hello world”)){}

return 0;

}

Output:

hello world

Related Post:

Features of C Programming Language

Variables in C

Data Types in C

Keywords in C

C Operators

Comments in C

Escape Sequence in C

C Functions

Storage Classes in C

Dynamic memory allocation in C

Factorial Program in C

Leap year program in C

Fibonacci Series in C

Prime Number program in C

Palindrome program in C

Sum of digits program in C

Escape Sequence in C

ASCII value in C

Difference Between Type Casting and Type Conversion in C

Difference Between Variables and Constants

Matrix multiplication in C

C Program to generate Fibonacci Triangle

C Program to swap two numbers without third variable

C Program to reverse number

Count the number of digits in C

Tokens in C

C Identifiers

C Strings

Compile time vs Runtime in C

C break statement

C goto statement

Type Casting in C

C String Functions

C Pointers

Dangling Pointers in C

void pointer in C

Pointer to Pointer in C

Recursion in C

Call by value and Call by reference in C

File Handling in C

C fprintf() and fscanf()

C fputc() and fgetc()

C fputs() and fgets()

C fseek() function

Constant Pointers in C

3 thoughts on “C Program to print “hello” without semicolon

  1. Pingback: C break statement - CloudNClear

  2. Pingback: C Pointers - CloudNClear

  3. Pingback: File Handling in C - CloudNClear

Comments are closed.