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 abstraction and encapsulation?
Why polymorphism is used in oops?
I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...
What is oops?what is its use in software engineering?
How to call a non virtual function in the derived class by using base class pointer
Can a destructor be called directly?
Write a program to sort the number with different sorts in one program ??
How oops is better than procedural?
Where is pseudocode used?
Why do we use polymorphism?
What is pointer in oop?
to find out the minimum of two integer number of two different classes using friend function
Can bst contain duplicates?
What are the 3 pillars of oop?
2. Give the different notations for the class.\