Print Hello word without using semicolon in C

January 11, 2025 3 Comments » Hits : 12






Part 1 : Printf Hello word in C without using semicolon [only ones ]


#include<stdio.h>
void main()
{
   if(printf("Hello"))
   {
   }
}

Output :

Hello

Part 2 : Printf Hello word in C without using semicolon [infinite times]


#include<stdio.h>
void main()
{
   while(printf("Hello"))
   {
   }
}

Part 3 : Printf Hello [Using Switch]


#include<stdio.h>
void main()
{
   switch(printf("Hello"))
   {
   }
}

Part 4 : Using Else-if Ladder


#include<stdio.h>
void main()
{
   if(printf(""))
      {
      }
   else if (printf("Hello"))
      {
      }
   else
      {
      }
}

Part 5 : Printf Hello [Using While and Not]


#include<stdio.h>
void main()
{
    while(!printf("Hello"))
    {
    }
}

Part 6 : Using #define


#include<stdio.h>
#define PRINT printf("Hello")
void main()
{
    if(PRINT)
    {
    }
}

3 Comments

  1. Biswajit July 3, 2024 at 6:17 am - Reply

    Hi,
    That was amazing. You not only omitted the semicolon while printing the string but you entirely avoided semicolon in the whole program. An in-depth understanding in C is necessary for System Programming. There are so many interesting things regarding syntax. I expect more such tricks will be published on this blog in near future. Please visit http://technolocus.blogspot.com/2010/06/issues-on-initialization-of-array.html where some advanced issues regarding initialization of arrays have been discussed. Thanks so much for your effort. Many students will find this not only informative but also amusing.
    God bless you

  2. lohi February 22, 2025 at 12:06 pm - Reply

    it was very interesting …

    how to learn more pgms like this

  3. Admin February 22, 2025 at 12:44 pm - Reply

    @lohi
    You can Explore More such programs here - https://www.c4learn.com/2010/07/c-programming-how-to-new-section.html

Leave A Response