series-4

1 1 1 1

2 2 2 2

3 3 3 3


 class series

{

public static void main(String args[])

{

for(int r=1;r<=3;r++)

{

for (int c=1 ; c<=4 ; c++)

{

System.out.print(r+ "  ");

}

System.out.println() // to come to next line

}

}

}


// common way

class series

{

public static void main(String args[])

{

int a=1, d=4;   //  a- means first value  d- means how many element in first line

for(int r=1;r<=3;r++)

{

for (int c=1 ; c<=d ; c++)

{

System.out.print(a+ "  ");


}

a++;

System.out.println() // to come to next line

}

}

}


Comments

Popular posts from this blog