How to Say “Happy New Year” in 20 Programming Languages
This article showcases simple code snippets that print a New Year greeting in twenty different programming languages, illustrating basic output syntax across Java, C, C++, Python, C#, PHP, JavaScript, Go, Swift, Ruby, VB, Perl, HTML, Scala, AWK, Pascal, and Prolog.
Java
System.out.println("祝大家新年快乐!");
C
printf("祝大家新年快乐!");
C++
std::cout << "祝大家新年快乐" << std::endl;
Python
print("祝大家新年快乐!")
C#
Console.WriteLine("祝大家新年快乐!");
PHP
echo "祝大家新年快乐!";
JavaScript
document.write("祝大家新年快乐!");
Go
fmt.print("祝大家新年快乐!");
Swift
print("祝大家新年快乐!")
Ruby
puts "祝大家新年快乐!"
VB
MsgBox("祝大家新年快乐!")
Perl
print "祝大家新年快乐!";
HTML
<p>祝大家新年快乐!</p>
Scala
println("祝大家新年快乐!");
AWK
echo | awk '{print "祝大家新年快乐!"}'
Pascal
writeln('祝大家新年快乐!')
Prolog
write("祝大家新年快乐!").
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
