A "Hello, World!" program generally is a computer program that outputs or displays the message "Hello, World!".It is often the first program written by people learning to code.
The tradition of using the phrase "Hello, World!" as a test message was influenced by an example program in the seminal 1978 book The C Programming Language.The example program in that book prints "hello, world", and was inherited from a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial.
Speaking of C Programming language, we know that ";" denotes the end of the statement. Standard code to print "Hello, World!" in C language is as follows:-
#include <stdio.h>
int main()
{
printf("Hello, World!");
return 0;
}
Now, the question is how to print without ";".
Solution:
# include<stdio.h>
int main()
{
if(printf("Hello, World!"))
{
//EMPTY BLOCK
}
return 0;
}
Explanation:
In C language, printf() function returns the number of characters that are printed. If there is some error then it returns a negative value.
Also, in C language any number other than "0" is treated as "true", thus after printing "Hello, World!" it returns an int value which is treated as "true".
Bonus:
Using JAVA Language:
public class Hello
{
public static void main(String [] args)
{
if(System.out.println("Hello, World!").equals(null))
{}
}
}
But, it's easy-peasy-japanesey using Python language.
print("Hello, World!")
:p
I hope 'twas helpful.
Top comments (0)