Print the message “Hello
World!”.
Input. There is no input data.
Output. Print the message “Hello World!” as shown in the example.
Sample
input |
Sample
output |
|
Hello World! |
elementary
problem
In this problem you must
print the message “Hello World!”.
Algorithm realization
– printf
Print the message “Hello World!” using the printf function.
#include <stdio.h>
int main(void)
{
printf("Hello
World!\n");
return 0;
}
Algorithm realization
– puts
Print the message “Hello World!” using the puts function. The puts function always terminates
the output with a newline character ‘\n’ (new line).
#include <stdio.h>
int main(void)
{
puts("Hello
World!");
return 0;
}
Java realization
Print the message “Hello World!” using the System.out.println function.
import java.util.*;
public class Main
{
public static void
main(String[] args)
{
System.out.println("Hello
World!");
}
}
Python realization
Print the message “Hello World!” using the print function.
print("Hello World!")
Go realization
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
C# realization
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleAppCSharp
{
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello World!");
}
}
}
Ruby realization
puts "Hello World!"
Rust realization
fn main() {
println!("Hello World!");
}
Haskell realization
main =
putStrLn "hello world"