Festival of Holi is around the corner and to all the coding geeks around there, let it be more than just a holiday and learn how can we wish our coding friends and surprise them with a code wish. HpY Holi :)
// CPP program to print Happy Holi
#include <bits/stdc++.h>
using namespace std;
int main()
{
// Print first row
// You can choose any char
char ch = '@';
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 ||
i == 11 || i == 14 || i == 15 ||
i == 16 || i == 17 || i == 19 ||
i == 20 || i == 21 || i == 22 ||
i == 24 || i == 27)
cout << ch;
else
cout << " ";
}
// Print second row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 17 ||
i == 19 || i == 22 || i == 24 ||
i == 27)
cout << ch;
else
cout << " ";
}
// Print third row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 ||
i == 7 || i == 9 || i == 10 ||
i == 11 || i == 12 || i == 14 ||
i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 ||
i == 22 || i == 25 || i == 26)
cout << ch;
else
cout << " ";
}
// Print fourth row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 19 ||
i == 25 || i == 26)
cout << ch;
else
cout << " ";
}
// Print fifth row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 19 || i == 25 || i == 26)
cout << ch;
else
cout << " ";
}
// Happy is printed, now print
// Holi row by row
cout << endl;
cout << endl;
cout << endl;
// Print first row
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 19 || i == 20 || i == 21 ||
i == 22)
cout << ch;
else
cout << " ";
}
// Print second row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
cout << ch;
else
cout << " ";
}
// Print third row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 || i == 7 ||
i == 9 || i == 12 || i == 14 || i == 20 ||
i == 21)
cout << ch;
else
cout << " ";
}
// Print fourth row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
cout << ch;
else
cout << " ";
}
// Print fifth row
cout << endl;
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 || i == 22)
cout << ch;
else
cout << " ";
}
}
// Java program to print Happy Holi
import java.io.*;
class GFG
{
public static void main (String[] args)
{
// Print first row
// You can choose any char
char ch = '@';
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 ||
i == 11 || i == 14 || i == 15 ||
i == 16 || i == 17 || i == 19 ||
i == 20 || i == 21 || i == 22 ||
i == 24 || i == 27)
System.out.print(ch);
else
System.out.print(" ");
}
// Print second row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 17 ||
i == 19 || i == 22 || i == 24 ||
i == 27)
System.out.print(ch);
else
System.out.print(" ");
}
// Print third row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 ||
i == 7 || i == 9 || i == 10 ||
i == 11 || i == 12 || i == 14 ||
i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 ||
i == 22 || i == 25 || i == 26)
System.out.print(ch);
else
System.out.print(" ");
}
// Print fourth row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 19 ||
i == 25 || i == 26)
System.out.print(ch);
else
System.out.print(" ");
}
// print fifth row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 19 || i == 25 || i == 26)
System.out.print(ch);
else
System.out.print(" ");
}
// Happy is printed, now print
// Holi row by row
System.out.println();
System.out.println();
System.out.println();
// Print first row
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 19 || i == 20 || i == 21 ||
i == 22)
System.out.print(ch);
else
System.out.print(" ");
}
// Print second row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
System.out.print(ch);
else
System.out.print(" ");
}
// Print third row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 || i == 7 ||
i == 9 || i == 12 || i == 14 || i == 20 ||
i == 21)
System.out.print(ch);
else
System.out.print(" ");
}
// Print fourth row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
System.out.print(ch);
else
System.out.print(" ");
}
// Print fifth row
System.out.println();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 || i == 22)
System.out.print(ch);
else
System.out.print (" ");
}
}
}
// This code is contributed by vt_m.
// C# program to print Happy Holi
using System;
class GFG
{
// Driver Code
public static void Main (String[] args)
{
// Print first row
// You can choose any char
char ch = '@';
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 ||
i == 11 || i == 14 || i == 15 ||
i == 16 || i == 17 || i == 19 ||
i == 20 || i == 21 || i == 22 ||
i == 24 || i == 27)
Console.Write(ch);
else
Console.Write(" ");
}
// Print second row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 17 ||
i == 19 || i == 22 || i == 24 ||
i == 27)
Console.Write(ch);
else
Console.Write(" ");
}
// Print third row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 ||
i == 7 || i == 9 || i == 10 ||
i == 11 || i == 12 || i == 14 ||
i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 ||
i == 22 || i == 25 || i == 26)
Console.Write(ch);
else
Console.Write(" ");
}
// Print fourth row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 19 ||
i == 25 || i == 26)
Console.Write(ch);
else
Console.Write(" ");
}
// print fifth row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 19 || i == 25 || i == 26)
Console.Write(ch);
else
Console.Write(" ");
}
// Happy is printed, now print
// Holi row by row
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
// Print first row
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 19 || i == 20 || i == 21 ||
i == 22)
Console.Write(ch);
else
Console.Write(" ");
}
// Print second row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
Console.Write(ch);
else
Console.Write(" ");
}
// Print third row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 || i == 7 ||
i == 9 || i == 12 || i == 14 || i == 20 ||
i == 21)
Console.Write(ch);
else
Console.Write(" ");
}
// Print fourth row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
Console.Write(ch);
else
Console.Write(" ");
}
// Print fifth row
Console.WriteLine();
for (int i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 || i == 22)
Console.Write(ch);
else
Console.Write(" ");
}
}
}
// This code is contributed by parashar....
<script>
function printHappyHoli() {
// Print Happy row by row
let ch = '@';
// Print first row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 ||
i == 11 || i == 14 || i == 15 ||
i == 16 || i == 17 || i == 19 ||
i == 20 || i == 21 || i == 22 ||
i == 24 || i == 27)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print second row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 17 ||
i == 19 || i == 22 || i == 24 ||
i == 27)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print third row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 ||
i == 7 || i == 9 || i == 10 ||
i == 11 || i == 12 || i == 14 ||
i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 ||
i == 22 || i == 25 || i == 26)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print fourth row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 ||
i == 12 || i == 14 || i == 19 ||
i == 25 || i == 26)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print fifth row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 19 || i == 25 || i == 26)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Happy is printed, now print Holi row by row
console.log();
console.log();
console.log();
// Print first row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 19 || i == 20 || i == 21 ||
i == 22)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print second row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print third row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 5 || i == 6 || i == 7 ||
i == 9 || i == 12 || i == 14 || i == 20 ||
i == 21)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print fourth row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 9 || i == 12 ||
i == 14 || i == 20 || i == 21)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
console.log();
// Print fifth row
for (let i = 1; i <= 34; i++) {
if (i == 4 || i == 7 || i == 10 || i == 11 ||
i == 14 || i == 15 || i == 16 || i == 17 ||
i == 19 || i == 20 || i == 21 || i == 22)
process.stdout.write(ch);
else
process.stdout.write(" ");
}
}
// Call the function to print the pattern
printHappyHoli();
</script>
# Python3 program to print Happy Holi
# Print first row
# You can choose any char
ch = '@'
for i in range(1, 35):
if (i == 4 or i == 7 or i == 10 or
i == 11 or i == 14 or i == 15 or
i == 16 or i == 17 or i == 19 or
i == 20 or i == 21 or i == 22 or
i == 24 or i == 27):
print(ch, end = "")
else:
print(end = " ")
print()
# Print second row
for i in range(1, 35):
if (i == 4 or i == 7 or i == 9 or
i == 12 or i == 14 or i == 17 or
i == 19 or i == 22 or i == 24 or i == 27):
print(ch, end = "")
else:
print(end = " ")
print()
# Print third row
for i in range(1, 35):
if (i == 4 or i == 5 or i == 6 or
i == 7 or i == 9 or i == 10 or
i == 11 or i == 12 or i == 14 or
i == 15 or i == 16 or i == 17 or
i == 19 or i == 20 or i == 21 or
i == 22 or i == 25 or i == 26):
print(ch, end = "")
else:
print(end = " ")
print()
# Print fourth row
for i in range(1, 35):
if (i == 4 or i == 7 or i == 9 or
i == 12 or i == 14 or i == 19 or
i == 25 or i == 26):
print(ch, end = "")
else:
print(end = " ")
print()
# Print fifth row
for i in range(1, 35):
if (i == 4 or i == 7 or i == 9 or
i == 12 or i == 14 or i == 19 or
i == 25 or i == 26):
print(ch, end = "")
else:
print(end = " ")
print()
# Happy is printed, now print
# Holi row by row
print()
print()
# Print first row
for i in range(1, 35):
if (i == 4 or i == 7 or i == 10 or
i == 11 or i == 14 or i == 19 or
i == 20 or i == 21 or i == 22):
print(ch, end = "")
else:
print(end = " ")
print()
# Print second row
for i in range(1, 35):
if (i == 4 or i == 7 or i == 9 or
i == 12 or i == 14 or i == 20
or i == 21):
print(ch, end = "")
else:
print(end = " ")
print()
# Print third row
for i in range(1, 35):
if (i == 4 or i == 5 or i == 6 or
i == 7 or i == 9 or i == 12 or
i == 14 or i == 20 or i == 21):
print(ch, end = "")
else:
print(end = " ")
print()
# Print fourth row
for i in range(1, 35):
if (i == 4 or i == 7 or i == 9 or
i == 12 or i == 14 or i == 20
or i == 21):
print(ch, end = "")
else:
print(end = " ")
print()
# Print fifth row
for i in range(1, 35):
if (i == 4 or i == 7 or i == 10 or i == 11 or
i == 14 or i == 15 or i == 16 or i == 17 or
i == 19 or i == 20 or i == 21 or i == 22):
print(ch, end = "")
else:
print(end = " ")
# This code is contributed by Azkia Anam.
Output:
@ @ @@ @@@@ @@@@ @ @
@ @ @ @ @ @ @ @ @ @
@@@@ @@@@ @@@@ @@@@ @@
@ @ @ @ @ @ @@
@ @ @ @ @ @ @@
@ @ @@ @ @@@@
@ @ @ @ @ @@
@@@@ @ @ @ @@
@ @ @ @ @ @@
@ @ @@ @@@@ @@@@