public class FloydsTriangle { public static void main(String[] args) { int num=1; for(int i=0;i<=6;i++){ for(int j=0;j<=i;j++){ System.out.print(" "+num); num++; } System.out.println(); } } }
Output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Thanks for reading. If you like this post please follow us for more updates about technology related updates.
No comments:
Post a Comment