trang chủ / bài tập / helloworld

Hello World

Đề bài

Mô tả

Chúng ta hãy bắt đầu hành trình học lập trình của mình bằng cách giải quyết bài toán kinh điển Hello world.

Mục tiêu của bạn là lập trình để in ra dòng chữ Hello, World! ra màn hình.

Lưu ý: Phải in ra chính xác chữ hoa thường và cả dấu câu nữa nhé.

Để có thể nộp bài, bạn tìm bên phải màn hình nút "Gửi bài giải", vào trang "Nộp bài", chọn ngôn ngữ lập trình và nộp bài. Khi đã nộp bài thành công, hãy thử với bài toán khó hơn một chút là A cộng B nhé!

Sau đây là gợi ý đáp án trong một vài ngôn ngữ thông dụng:

C

#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}

C++

#include <iostream>

using namespace std;

int main() {
    cout << "Hello, World!" << endl;
    return 0;
}

Pascal

program helloworld;
begin
  writeln('Hello, World!');
end.

Python

print("Hello, World!")

Go

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Perl

print "Hello, World!\n";

Kotlin

fun main(args: Array<String>) {
    print("Hello, World!")
}

Rust

fn main() {
    println!("Hello, World!");
}

Java

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

C#

class HelloWorld {
    public static void Main(string[] args) {
        System.Console.WriteLine("Hello, World!");
    }
}

Javascript

console.log('Hello, World!');

Ruby

puts "Hello, World!"

Groovy

println "Hello, World!"

Dart

void main() {
  print('Hello, World!');
}

PHP

<?php
echo "Hello, World!\n";

ZIG

const std = @import("std");

pub fn main() !void {
  _ = try std.posix.write(std.posix.STDOUT_FILENO, "Hello, World!\n");
}

Scratch

Bình luận

gnatmake 12.2.0 a68g 3.1.2 nasm 2.16.1 as_x64 2.47 awk 1.3.4 gcc 16.2.0 dotnet 10.0.400 g++ 16.2.0 g++-themis 16.2.0 g++17 16.2.0 g++20 16.2.0 g++23 16.2.0 clang++ 22.1.8 dmd 2.113.0 dart 3.13.2 gforth 0.7.3 gfortran 12.2.0 go 1.27.0 groovyc 5.1.1 javac 25.0.4 node 26.8.1 julia 1.12.7 kotlinc 2.4.10 lean 4.33.1 sbcl 2.2.9 lua 5.4.9 nim 2.2.10 fpc 3.2.2 fpc-themis 3.2.2 perl 5.36.0 php 8.5.10 pike 8.0 swipl 9.0.4 pypy3 7.3.23 python3 3.14.7 racket 8.7 ruby 4.0.6 rustc 1.98.0 csc 5.3.0 ctoj-scratch 0.0.1 sed 4.9 swiftc 6.3.3 tclsh 8.6 bun 1.4.0 deno 2.9.6 v 0.5.2 zig 0.16.0