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 do you mean by overloading?
why reinterpret cast is considered dangerous?
Whats oop mean?
What does enum stand for?
What is encapsulation and abstraction? How are they implemented in C++?
What is inheritance in simple words?
What is solid in oops?
Explain the concepts involved in Object Oriented programming.
What is the advantage of oop over procedural language?
What is an advantage of polymorphism?
What is oops?what is its use in software engineering?
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
Can an interface inherit a class?
Why is abstraction used?
What does oop mean in snapchat?