C-Programming Tutorials

C Program to Print Without Semicolon

This C program is used to print on the screen without using a semicolon.

Semicolon must be used after printf function, but we can avoid this, by using printf function with ifwhile or switch statements.

Program:

#include<stdio.h>

void main() {

    //Method One

    if(printf("Hello world"))

    {

    }

       //Method Two

    while(!printf("Hello world"))

    {

    }

       //Method Three

    switch(printf("Hello world"))

    {

    }

}

Output:

Hello world

Hello world

Hello world

 

C Program to Generate the Fibonacci Series (Prev Lesson)
(Next Lesson) C Program to Convert Number into Word
Back to C-Programming Tutorials

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!