Write a program to print “hello world” without using a semicolon?

#include
void main(){
if(printf(“hello world”)){} // It prints the ?hello world? on the screen.
}

To print “hello world” without using a semicolon in a C program, you can use the \n escape sequence to represent a newline character instead of a semicolon. Here’s the program:

c
#include <stdio.h>

int main() {
if (printf("hello world\n")) {
}
return 0;
}

In this program:

  • printf("hello world\n") is used to print “hello world” followed by a newline character.
  • The if statement checks the return value of printf(), which returns the number of characters printed. Since "hello world\n" has more than 0 characters, the if condition evaluates to true. However, the body of the if statement is empty, so there’s no semicolon following the if statement.
  • Finally, return 0; is used to indicate successful execution of the program.