DEV Community

Mohammed Riyas
Mohammed Riyas

Posted on

Printing my name Riyas using Star *

public class Main
{
    public static void main(String[] args) {
      System.out.println("*****");
       for(int i=0;i<3;i++)
       {
           System.out.print("*");
           for(int j=0;j<3;j++)
           {
               System.out.print(" ");
           }
           System.out.print("*");
           System.out.println("");
       }
       System.out.println("*****");
       for(int i=0;i<5;i++)
       {
           System.out.print("*");
           for(int j=0;j<i;j++)
           {
               System.out.print(" ");
           }
           System.out.print("*");
           System.out.println("");
       }
       System.out.println("");
       for(int i=0;i<5;i++)
       {
           System.out.println("*");
       }
       System.out.println(" ");
       for(int i=0;i<5;i++)
       {
         for(int j=0;j<i;j++)
         {
             System.out.print(" ");
         }
         System.out.print("*");
         for(int k=0;k<5-i;k++)
         {
             System.out.print(" ");
         }https://www.onlinegdb.com/online_java_compiler#debug_window_display_expression
         System.out.print("*");
         System.out.println(" ");
       }
       for(int i=0;i<5;i++)
       {
           for(int j=0;j<5;j++)
           {
               System.out.print(" ");
           }
           System.out.print(" *");
           System.out.println(" ");
       }
System.out.println("");
for(int i=0;i<5;i++)
{
    for(int j=0;j<5-i;j++)
    {
        System.out.print(" ");
    }
    System.out.print("*");
    for(int k=0;k<i;k++)
    {
         if(i==2)
    {
        System.out.print("**");
        break;
    }
        System.out.print(" ");
    }

    System.out.print("*");
    System.out.println("");
}
System.out.println("");
System.out.print("*****");
for(int i=0;i<5;i++)
{
    System.out.println("*");
}
System.out.print("******");
System.out.println("");
for(int i=0;i<5;i++)
{
  for(int j=0;j<5;j++)
  {
      System.out.print(" ");
  }
  System.out.print("*");
  System.out.println(" ");
}
System.out.println("******");
    }
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)