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


Please Help Members By Posting Answers For Below Questions

What do you mean by overloading?

576


why reinterpret cast is considered dangerous?

1896


Whats oop mean?

586


What does enum stand for?

607


What is encapsulation and abstraction? How are they implemented in C++?

632






What is inheritance in simple words?

623


What is solid in oops?

600


Explain the concepts involved in Object Oriented programming.

629


What is the advantage of oop over procedural language?

623


What is an advantage of polymorphism?

589


What is oops?what is its use in software engineering?

555


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).

1636


Can an interface inherit a class?

557


Why is abstraction used?

601


What does oop mean in snapchat?

680