Write a program to accept a number and to print numbers in
pyramid format?
for eg:for a no. 5
1
212
32123
4321234
543212345
Answer Posted / rathod rajesh
for(int i=1;i<=5;i++)
{
for(int k=5;k>=i;k--)
{
System.out.print(" ");
}
for(int j=i;j>=1;j--)
{
System.out.print(j);
}
for(int j=2;j<=i;j++)
{
System.out.print(j);
}
System.out.println();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is polymorphism and why is it important?
What polymorphism means?
What does no cap mean?
What is polymorphism what are the different types of polymorphism?
What is destructor example?
what's the basic's in dot net
How do you answer polymorphism?
What is polymorphism in oop example?
What is interface? When and where is it used?
What is encapsulation in ict?
What does I oop mean?
Can private class be inherited?
What are the 4 pillars of oop?
what are the ways in which a constructors can be called?
What is the highest level of cohesion?