Computer Science, asked by TreeshaBiswas, 4 months ago

1
121
12321
1234321
print this pattern using Java programming, for loop​


sonupatel51: aap shayed adrsha school ka naam tho suna hi hoga
sonupatel51: haa yrr
himanshu2006vps: haa
sonupatel51: sry aap ko mere vajese daat padrahi hai
himanshu2006vps: koi baat nhi bye
sonupatel51: kalle baat karenge apun
sonupatel51: ok
sonupatel51: himaanshu
sonupatel51: take care
sonupatel51: bye

Answers

Answered by pooja45242
3

Answer:

public class Pyramid

{

public static void main(String[] args)

{

int i=0,j=0,n=6,k=0;

for(i=0; i<n; i++)

{

k=1;

for(j=0; j<(n+i); j++)

{

if(j<n-i-1)

System.out.print(" ");

else

{

System.out.print(""+k);

if(j<(n-1))

k++;

else

k--;

}

}

System.out.println(" ");

}

}

}

Explanation:

follow and like and mark as brainliest


TreeshaBiswas: is it pyramid pattern only??
sonupatel51: is it pyramid pattern onli
sonupatel51: Only???
sonupatel51: i can't shore
himanshu2006vps: just check my pattern dude
sonupatel51: haa ok
himanshu2006vps: ok
himanshu2006vps: brainly.in
himanshu2006vps: search karo googl mai
himanshu2006vps: aur login kro
Answered by himanshu2006vps
2

import java.io.*;

public class Program

{

public static void main(String []args)

{

int n=5;

for(int i=1;i<=n;i++)

{

for(int j=i;j<=n-1;j++)

{

System.out.print(" ");

}

for(int j=1;j<=i;j++) {

System.out.print(j);

}

for(int j=i-1;j>=1;j--) {

System.out.print(j);

}

System.out.println();

}

}

}

output-

1

121

12321

1234321

123454321

Similar questions