Program to wish Women’s Day

20 Jul, 2021
This article demonstrates the pattern to print the Venus Symbol (International gender symbol for females).  
C++
Java
Python3
C#
Javascript
// C++ code to wish happY Women's DaY #include <bits/stdc++.h>using namespace std;int main(){    // Initializing size of    // design    int n = 5;     // Loop to print Circle    // (Upper part of design)    // Outer loop to    // control height of    // design    for (int i = 0; i <= 2 * n; i++) {        // Inner loop to control        // width        for (int j = 0; j <= 2 * n; j++) {             // computing distance of            // each point from center            float center_dist = sqrt((i - n) * (i - n) +                                     (j - n) * (j - n));             if (center_dist > n - 0.5                && center_dist < n + 0.5)                cout << "$";            else                cout << " ";        }         // Printing HappY Women's DaY        if (i == n)            cout << " "                 << "HappY Women's DaY";        cout << endl;    }     // Loop to print lower part    // Outer loop to control    // height    for (int i = 0; i <= n; i++) {         // Positioning pattern        // Loop for Printing        // horizontal line        if (i == (n / 2) + 1) {            for (int j = 0; j <= 2 * n; j++)                if (j >= (n - n / 2) && j <= (n + n / 2))                    cout << "$";                else                    cout << " ";        }        else {             for (int j = 0; j <= 2 * n; j++) {                if (j == n)                    cout << "$";                else                    cout << " ";            }        }        cout << endl;    }}
// Java code to wish happY Women's DaYimport java.io.*; class GFG{    public static void main (String[] args)    {        // Initializing size of        // design        int n = 5;             // Loop to print Circle        // (Upper part of design)        // Outer loop to        // control height of        // design        for (int i = 0; i <= 2 * n; i++)        {            // Inner loop to control            // width            for (int j = 0; j <= 2 * n; j++) {                     // computing distance of                // each point from center                float center_dist =(float) Math.sqrt((i - n) *                                    (i - n) +    (j - n) * (j - n));                     if (center_dist > n - 0.5                    && center_dist < n + 0.5)                    System.out.print("$");                else                    System.out.print(" ");            }                 // Printing HappY Women's DaY            if (i == n)                System.out.print(" "                    + "HappY Women's DaY");                    System.out.println();        }             // Loop to print lower part        // Outer loop to control        // height        for (int i = 0; i <= n; i++) {                 // Positioning pattern            // Loop for Printing            // horizontal line            if (i == (n / 2) + 1) {                for (int j = 0; j <= 2 * n; j++)                    if (j >= (n - n / 2) && j <= (n + n / 2))                        System.out.print("$");                    else                        System.out.print(" ");            }            else {                     for (int j = 0; j <= 2 * n; j++) {                    if (j == n)                        System.out.print("$");                    else                        System.out.print(" ");                }            }            System.out.println();        }    }      } // This code is contributed by vt_m.
# Python 3 code to wish HaPpY Women's DaY import math # Initializing size of# designn = 5 # Loop to print Circle# (Upper part of design)# Outer loop to# control height of# designfor i in range(0, 2 * n + 1):         # Inner loop to control    # width    for j in range(0, 2 * n + 1):             # computing distance of        # each point from center        center_dist = math.sqrt((i - n) * (i - n)                             + (j - n) * (j - n))        if (center_dist > n - 0.5                  and center_dist < n + 0.5):            print("$", end = "")        else:            print(end = " ")             # Printing HappY Women's DaY    if (i == n):        print(" ","HappY Women's DaY",end = "")    print("") # Loop to print lower part# Outer loop to control# heightfor i in range(0, n+1) :     # Positioning pattern    # Loop for Printing    # horizontal line    if (i == int(n / 2) + 1):        for j in range(0, 2 * n + 1):            if (j >= (n - int(n / 2))                   and j <= (n + int(n / 2))):                print("$", end = "")            else:                print(end = " ")    else :        for j in range(0, 2 * n + 1):            if (j == n):                print("$", end = "")            else:                print(end = " ")    print("")     #  This code is contributed by Smitha.
// C# code to wish happY Women's DaYusing System; class GFG{    public static void Main ()    {        // Initializing size of        // design        int n = 5;             // Loop to print Circle        // (Upper part of design)        // Outer loop to        // control height of        // design        for (int i = 0; i <= 2 * n; i++)        {            // Inner loop to control            // width            for (int j = 0; j <= 2 * n; j++) {                     // computing distance of                // each point from center                float center_dist =                       (float) Math.Sqrt((i - n) *                       (i - n) + (j - n) * (j - n));                     if (center_dist > n - 0.5                          && center_dist < n + 0.5)                    Console.Write("$");                else                    Console.Write(" ");            }                 // Printing HappY Women's DaY            if (i == n)                Console.Write(" "                      + "HappY Women's DaY");                    Console.WriteLine();        }             // Loop to print lower part        // Outer loop to control        // height        for (int i = 0; i <= n; i++) {                 // Positioning pattern            // Loop for Printing            // horizontal line            if (i == (n / 2) + 1) {                for (int j = 0; j <= 2 * n; j++)                    if (j >= (n - n / 2)                             && j <= (n + n / 2))                        Console.Write("$");                    else                        Console.Write(" ");            }                         else {                     for (int j = 0; j <= 2 * n; j++) {                    if (j == n)                        Console.Write("$");                    else                        Console.Write(" ");                }            }            Console.WriteLine();        }    }} // This code is contributed by vt_m.
<script> // Initializing size of        // design        let n = 5;               // Loop to print Circle        // (Upper part of design)        // Outer loop to        // control height of        // design        for (let i = 0; i <= 2 * n; i++)        {            // Inner loop to control            // width            for (let j = 0; j <= 2 * n; j++) {                       // computing distance of                // each point from center                let center_dist = Math.sqrt((i - n) *                                    (i - n) +    (j - n) * (j - n));                       if (center_dist > n - 0.5                    && center_dist < n + 0.5)                    document.write("$");                else                    document.write("  ");            }                   // Printing HappY Women's DaY            if (i == n)                document.write("  "                    + "HappY Women's DaY");                    document.write("<br>");        }               // Loop to print lower part        // Outer loop to control        // height        for (let i = 0; i <= n; i++) {                   // Positioning pattern            // Loop for Printing            // horizontal line            if (i == Math.floor(n / 2) + 1) {                for (let j = 0; j <= 2 * n; j++)                    if (j >= (n - n / 2) && j <= (n + n / 2))                        document.write("$");                    else                        document.write("  ");            }            else {                       for (let j = 0; j <= 2 * n; j++) {                    if (j == n)                        document.write("$");                    else                        document.write("  ");                }            }            document.write("<br>");        }// This code is contributed by rag2127</script>
Output:  
   $$$$$   
  $     $  
 $       $ 
$         $
$         $
$         $ HappY Women's DaY
$         $
$         $
 $       $ 
  $     $  
   $$$$$   
     $     
     $     
     $     
   $$$$$   
     $     
     $     
This article is contributed by Shambhavi Singh and Astha Tyagi. 
Smitha Dinesh Semwal
Akanksha_Rai
unknown2108
pattern-printing
School Programming
pattern-printing
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Constructors in Java
Exceptions in Java
Python Exception Handling
Python Try Except
Ternary Operator in Python
How JVM Works - JVM Architecture?
Python program to add two numbers
Variables in Java
Data types in Java
Difference between Abstract Class and Interface in Java