Created
July 28, 2019 13:43
-
-
Save hrsvrdhn/314add606a7c57e2f66856381f3e6bb2 to your computer and use it in GitHub Desktop.
Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class printPattern { | |
public static void main(String args[]) { | |
for(int i=0; i<4; i++) { // yeh loop 4 baar chalega | |
//for loop to print spaces | |
for(int j=0; j<i; j++) { | |
System.out.print(" "); | |
} | |
//for loop to print numbers | |
for(int k=1; k<=4-i; k++) { | |
System.out.print(k); | |
} | |
//for loop to print @ | |
for(int l=1; l<=4-i; l++) { | |
System.out.print("@"); | |
} | |
System.out.println(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment