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 multilevel inheritance?
What is object and example?
What is stream in oop?
explain sub-type and sub class? atleast u have differ it into 4 points?
What are the types of abstraction?
What are the 4 pillars of oop?
What causes polymorphism?
What is purpose of inheritance?
Whats oop mean?
What is polymorphism what are the different types of polymorphism?
what is the drawback of classical methods in oops?
How to improve object oriented design skills?
What is destructor oops?
to find out the minimum of two integer number of two different classes using friend function
How to call a non virtual function in the derived class by using base class pointer