Write a C Program to Print Same Alphabet in each Right Triangle Column using for loop. Or, Write a program to print the repeated characters or same alphabets in each right triangle column using for loop.
#include <stdio.h> int main() { int i, j, rows, alphabet = 65; printf("Enter Right Triangle Columns with Same Alphabets Rows = "); scanf("%d",&rows); printf("Right Triangle Columns with Same Alphabets Pattern\n"); for (i = 0 ; i < rows; i++ ) { for (j = 0 ; j <= i; j++ ) { printf("%c ", alphabet); } alphabet++; printf("\n"); } return 0; }
This C example displays the right triangle pattern of repeated characters in each column using a while loop.
#include <stdio.h> int main() { int i = 0, j, rows, alphabet = 65; printf("Enter Right Triangle Columns with Same Alphabets Rows = "); scanf("%d",&rows); printf("\nRight Triangle Columns with Same Alphabets Pattern\n"); while ( i < rows ) { j = 0 ; while( j <= i) { printf("%c ", alphabet); j++ ; } alphabet++; printf("\n"); i++; } return 0; }
Enter Right Triangle Columns with Same Alphabets Rows = 12
Right Triangle Columns with Same Alphabets Pattern
A
B B
C C C
D D D D
E E E E E
F F F F F F
G G G G G G G
H H H H H H H H
I I I I I I I I I
J J J J J J J J J J
K K K K K K K K K K K
L L L L L L L L L L L L
C program to print the same alphabets in every right Triangle row-column using a do while loop.
#include <stdio.h> int main() { int i = 0, j, rows, alphabet = 65; printf("Enter Right Triangle Columns with Same Alphabets Rows = "); scanf("%d",&rows); printf("\nRight Triangle Columns with Same Alphabets Pattern\n"); do { j = 0 ; do { printf("%c ", alphabet); } while( ++j <= i); alphabet++; printf("\n"); } while ( ++i < rows ); return 0; }
Enter Right Triangle Columns with Same Alphabets Rows = 15
Right Triangle Columns with Same Alphabets Pattern
A
B B
C C C
D D D D
E E E E E
F F F F F F
G G G G G G G
H H H H H H H H
I I I I I I I I I
J J J J J J J J J J
K K K K K K K K K K K
L L L L L L L L L L L L
M M M M M M M M M M M M M
N N N N N N N N N N N N N N
O O O O O O O O O O O O O O O