Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GaganAjayBansal {
- public static void main(String[] args) {
- for (int i = 1; i <= 7; i++) {
- int val= 0; // value to be printed
- int count = 1; // used for logic
- for (int j = 1; j <= i+i-1; j++) {
- if (count <= i) {
- val++;
- } else {
- val--;
- }
- System.out.print(val + " ");
- count++;
- }
- System.out.println();
- }
- }
- }
Add Comment
Please, Sign In to add comment