Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Q 10,11
- public class Main{
- public static void main (String args[]){
- // 1st pattern
- for(int i=1 ; i<=4 ; i++){
- for(int j = 1 ; j<=i ; j++)
- System.out.print(j+" ");
- System.out.println();
- }
- // 2nd pattern
- int j=1;
- for(int i=1 ; i<=4 ; i++){
- for(int k=1; k<=i ; k++){
- System.out.print(j+" ");
- j++;
- }
- System.out.println();
- }
- }
- }
- /*
- 1
- 1 2
- 1 2 3
- 1 2 3 4
- 1
- 2 3
- 4 5 6
- 7 8 9 10
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement