To create the pyramid pattern of numbers 1, 11, 121, 1221, 12321 in C, you can use nested loops. The outer loop iterates through the rows, while the inner loop builds each row by printing numbers from 1 up to the current row index and then back down to 1. Here's a simple code snippet:
#include <stdio.h>
int main() {
for (int i = 1; i <= 5; 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 code will output the desired pyramid pattern.
Chat with our AI personalities
#include <iostream> int main() { std::cout << "1 121 12321 1234321" << std::endl; return 0; }
21 The pattern is 121, 12321, 1234321
121, 484, 12321, 1234321, 123454321, 12345654321, 1234567654321, 123456787654321, 1234567897654321, 1002001, 10201, 100020001, 10000200001, 1000002000001
A number that reads the same backwards as it does forwards. For example 1357531, or 121.
Palindromic numerical sequences are series of numbers that read the same when read either forward or backward, such as: 6 121 474 12321 22522 459878954