C Online Compiler
Example: C Program to Print Half Pyramid Pattern of Alphabets
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Print Half Pyramid Pattern of Alphabets #include <stdio.h> int main() { int rows; char alphabet = 'A'; printf("Enter the number of rows: "); scanf("%d", &rows); if (rows > 0) { for (int i = 1; i <= rows; i++) { for (int j = 1; j <= i; j++) { printf("%c ", alphabet); } alphabet++; printf("\n"); } } return 0; }
5
Output
Clear
ADVERTISEMENTS