Sing Happy Birthday to your favourite programming language - Programming Puzzles

Your favourite programming language has just had a birthday. Be nice and sing it the Happy Birthday song.

Of course you should accomplish this by writing a program in that language. The program takes no input, and writes the following text to the standard output or an arbitrary file:

Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear [your favourite programming language]
Happy Birthday to You

But you can't repeat any word in hard coded string.

Solutions

Jump to C, CSharp, JavaScript, PHP Solution.
You can submit your own solution in comment section in same/different programming language. If your solution is better or in different language we'll add here.

C

#include<stdio.h>
int main()
{
	for(int c;c-5;)
		printf("Happy Birthday %s\n",++c-4?"To You":"Dear C");
	return 0;
}

CSharp

using System;

namespace testcs
{
    class Program
    {
        static void Main(string[] args)
        {
            string x = "\nHappy Birthday ", y = x + "to You";
            Console.Write(y + y + x + "Dear C#" + y);
        }
    }
}

JavaScript

<html>  
<body> 
    <script>
        console.log(a=(b="Happy Birthday ")+"to You\n",a,b+"Dear Javascript\n",a)
    </script>
</body>  
</html>

PHP

<? $h="<br>Happy birthday ";$t="to you";$d="dear PHP";echo "$h$t$h$t$h$d$h$t";

Share Tweet Send
0 Comments
Loading...
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.