Created
November 24, 2018 17:34
-
-
Save yashgyy/b4eeeaa682f5fb1aff0cce561e64ed85 to your computer and use it in GitHub Desktop.
Pattern Java Inverted Py
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
/* package whatever; // don't place package name! */ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
/* Name of the class has to be "Main" only if the class is public. */ | |
class Ideone | |
{ | |
public static void makePattern(int n){ | |
int temp=1; | |
for(int i=0;i<n;i++){ | |
for(int j=0;j<=i;j++){ | |
System.out.print(temp++); | |
if(i!=j) System.out.print("*"); | |
} | |
System.out.println(); | |
} | |
for(int i=n;i>0;i--){ | |
int x; | |
for(x=i;x>0;x--){ | |
System.out.print(temp-x); | |
if(x!=1) System.out.print("*"); | |
} | |
temp=temp-i; | |
System.out.println(); | |
} | |
} | |
public static void main (String[] args) { | |
int n=4; | |
makePattern(n); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment