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 polymorphism in oops with example?
Which is not an object oriented programming language?
What is this pointer in oop?
What is the purpose of polymorphism?
What is pure oop?
What are the two different types of polymorphism?
What does it mean when someone says I oop?
What is methods in oop?
What exactly is polymorphism?
Can a destructor be called directly?
Can we create object of abstract class?
Why is abstraction needed?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?
hi all..i want to know oops concepts clearly can any1 explain??
What language is oop?