Skip to content

Instantly share code, notes, and snippets.

@bijay-shrestha
Created July 4, 2021 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bijay-shrestha/1e2d52bd3899f1415f0e1d5504ca448f to your computer and use it in GitHub Desktop.
Save bijay-shrestha/1e2d52bd3899f1415f0e1d5504ca448f to your computer and use it in GitHub Desktop.
/**
*
* Print numbered Flag
* 1
* 2 3
* 4 5 6
* 7 8 9 10
* 11 12 13 14 15
*
*/
package com.basic.practice;
public class NumberedFlag {
public static void main(String[] args) {
int num = 1;
for (int i = 0; i < 5; i++) {
for (int j = 0; j <= i; j++) {
System.out.print(num + " ");
num++;
}
System.out.println("");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment