series-9
*
* *
* * *
* * * *
class series
{
public static void main(String args[])
{
for(int r=1;r<=4;r++)
{
for (int c=1 ; c<=r ; c++)
{
System.out.print("*"+ " ");
}
System.out.println() // to come to next line
}
}
}
// common way
class series
{
public static void main(String args[])
{
int d=1; // d- means how many element in first line
for(int r=1;r<=4;r++)
{
for (int c=1 ; c<=d ; c++)
{
System.out.print('*'+ " ");
}
d++;
System.out.println() // to come to next line
}
}
}
Nice logic sir
ReplyDeleteExcellent work
ReplyDeletenice job sir
ReplyDelete