To print a Floyd's triangle

PROGRAM :

public class Floyd {
          public static void main(String[] args) {
       
        int i,j,n=1;
        for(i=1;i<10;i++)
        {
        for(j=1;j<i;j++){
       
        
        System.out.print(+j);
        }
        System.out.println();
       
    }
}
}

OUTPUT :

1
12
123
1234
12345
123456
1234567
12345678

No comments:

Post a Comment