Created
November 5, 2018 06:36
-
-
Save hi-manshu/f8a876ab019ed05e5c3b895fc2d02eca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import java.util.Scanner; | |
| public class Pattern { | |
| public static void printPattern(int n) { | |
| for (int i = 1; i <= n; i++) { | |
| for (int j = i; j >= 1; j--) { | |
| System.out.print(j + " "); | |
| } | |
| System.out.println(); | |
| } | |
| } | |
| public static void main(String[] args) { | |
| Scanner scanner = new Scanner(System.in); | |
| System.out.print("Enter a number: "); | |
| int n = scanner.nextInt(); | |
| printPattern(n); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment