Decode the logic and print the Pattern that corresponds to given input. If N= 3 then pattern will be : 10203010011012 **4050809 ****607
Answers
Answered by
2
Answer:
dont know bro sorry please
Answered by
3
Answer:
package tcsnqt;
import java.util.Scanner;
public class printpattern {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a=1,b=n*(n+1)+1,c=0;
for(int i=n;i>=1;i--)
{
for(int j=0;j<c;j++)
{
System.out.print("*");
}
c=c+2;
for(int j=a;j<a+i;j++)
{
System.out.print(j+"0");
}
a=a+i;
for(int j=b-i;j<b;j++)
{
if(j==b-1)
System.out.println(j);
else
System.out.print(j+"0");
}
b=b-i;
}
}
}
Step-by-step explanation:
Similar questions