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 / pravin pawar
public static void main(String args[])
{
for(int r=1;r<=5;r++)
{
for(int s=5-r;s>0;s--)
System.out.print(" ");
for(int c=r;c>=1;c--)
System.out.print(c);
for(int c=2;c<=r;c++)
System.out.print(c);
System.out.print("\n");
}
}
| Is This Answer Correct ? | 8 Yes | 3 No |
Post New Answer View All Answers
Which language is pure oop?
What is polymorphism what is it for and how is it used?
what are the different types of qualifier in java?
What is abstraction in oop?
Can you explain polymorphism?
What is class and object with example?
is there any choice in opting subjects like 4 out of 7
What is static in oop?
What is oops?what is its use in software engineering?
Describe these concepts: Polymorphism, Inheritance and Abstraction.
What is the highest level of cohesion?
What is basic concept of oop?
What are the three parts of a simple empty class?
What is object in oop?
What is polymorphism in oop example?