Pattern- 8 Star Print
Logic-
for(int i=1; i<=5; i++)
{
for(int j=2; j<=i; j++)
{
System.out.print(" ");
}
{
for(int k=i; k<=5; k++)
System.out.print("* ");
}
System.out.println( );
}
Program--
* * * * *
* * * *
* * *
* *
*
class Pattern8
{
public static void main(String[] args)
{
for(int i=1; i<=5; i++)
{
for(int j=2; j<=i; j++)
{
System.out.print(" ");
}
{
for(int k=i; k<=5; k++)
System.out.print("* ");
}
System.out.println( );
}
}
}
For Proper Understanding Watch the Video :-
Thanks;)
All the Best :)
Keep Learning:)
Study:)
No comments:
Post a Comment