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 / suresh
#include <stdio.h>
int main() {
int i;
int j;
int k;
for (i = 1; i <= 5; i++) {
for (j = i; j >= 1; j--) {
printf("%d", j);
}
for (k = 2; k <= i; k++) {
printf("%d", k);
}
printf(" ");
}
printf("n");
return 0;
}
| Is This Answer Correct ? | 4 Yes | 5 No |
Post New Answer View All Answers
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
What is the example of polymorphism?
Which type does string inherit from?
When not to use object oriented programming?
officer say me - i am offered to a smoking , then what can you say
What is super in oop?
Can destructor be overloaded?
What is object-oriented programming? Webopedia definition
What is the real life example of polymorphism?
What is pointer in oop?
What are the features of oop?
What is encapsulation in oops?
What causes polymorphism?
explain sub-type and sub class? atleast u have differ it into 4 points?
Why oops is important?