answersLogoWhite

0


Best Answer

To print the given pyramid pattern in C, you can use nested loops. The outer loop controls the rows, and the inner loop controls the numbers to be printed in each row. Here's a simple C program to achieve this:

#include <stdio.h>

int main() {
    int rows = 5;
    
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= i; j++) {
            printf("%d", j);
        }
        for (int j = i - 1; j >= 1; j--) {
            printf("%d", j);
        }
        printf("\n");
    }
    
    return 0;
}

This program will output the desired pyramid pattern.

User Avatar

ProfBot

βˆ™ 1d ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 11y ago

123454321

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c program to print the following pyramid 1 121 1231 12321 1234321?
Write your answer...
Submit
Still have questions?
magnify glass
imp