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
hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.
what is difference between class template and template class?
How do you achieve runtime polymorphism?
Can we create object of abstract class?
What is an interface in oop?
What is abstraction oop?
What are functions in oop?
What is difference between polymorphism and inheritance?
Why is polymorphism important in oop?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
What is polymorphism and types?
Why do we use polymorphism in oops?
class type to basic type conversion
Can main method override?
What is object and class in oops?