Posts

Showing posts with the label c programming pattern

C program to display alphabet pattern T with Asterisk

Image
  C program to Print  Alphabet  T  Using star pattern   Example  #include <stdio.h> int main () {     int a, b;     int n = 7 ; // height of the T     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ;  b < n; b ++ ) {             // Print * for the top bar and vertical middle bar             if (a == 0 || b == n / 2 )                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }     return 0 ; } This C Program Print a pattern in the shape of the capital letter T using asterisks (*)  Explain Program Step 1 ]     #include <stdio.h> int main() {   ...

c program to display alphabet pattern R with asterisk

Image
 C program to Print  Alphabet  R star pattern  Star pattern  C program to Print  Alphabet  R Example  #include <stdio.h> int main () {     int rows;     printf ( "Enter Rows = " );     scanf ( " %d " , & rows);     for ( int a = 0 ; a < rows; a ++ )     {         for ( int b = 0 ; b < rows; b ++ )        {             if ((a == 0 || a == rows / 2 ) && ( 0 < b < rows - 1 ))          {                 printf ( "*" );             }             else if ((a != 0 ) && (b == 0 || (b == rows - 1 && a < rows / 2 )))             {                 printf ( "*" ); ...

C Program to print Alphabet P Pattern

Image
 C program to Print  Alphabet  P star pattern  Print the alphabet P in star pattern  in c Example  #include <stdio.h> int main () {     int a, b;     int n = 7 ; // height of P     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b <= n; b ++ ) {             // Print * for the left vertical line of P             if (b == 0 || (a == 0 && b < n) || (a == n / 2 && b < n) || (b == n && a != 0 && a <= n / 2 ))                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }     return 0 ; } This C Program Print a pattern in the shape of the ...

c program to display alphabet pattern O with asterisk

Image
   C program to Print  Alphabet  O star pattern  C program to Print  Alphabet  O star pattern  Example  #include <stdio.h> int main () {     int a, b;     int n = 7 ; // height and width of the O     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b < n; b ++ ) {             // Print * for the boundary of O             if ((a == 0 || a == n - 1 ) && (b > 0 && b < n - 1 ) || (b == 0 || b == n - 1 ) && (a > 0 && a < n - 1 ))                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }     return 0 ; } This C ...

c program to display alphabet pattern N with asterisk

Image
 C program to Print  Alphabet  N star pattern  C program to Print  Alphabet  N star pattern  Example  #include <stdio.h> int main () {     int a,b;     int n = 7 ; // height of the N (can be adjusted)     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b < n; b ++ ) {             // Print * for the first column, last column, and diagonal             if (b == 0 || b == n - 1 || b == a)                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }     return 0 ; } This C Program Print a pattern in the shape of the capital letter R using asterisks (*)  Explain Program Step ...

c program to display alphabet pattern L with asterisk

Image
                                             C program C program to Print  Alphabet  L star pattern  Example  #include <stdio.h> int main () {     int a,b;     int n = 7 ; // height of the L     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b < n; b ++ ) {             // Print * for the left vertical line and the bottom horizontal line             if (b == 0 || (a == n - 1 && b < n)) {                 printf ( "*" );             } else {                 printf ( " " );             }         }         printf ( " \n " ); ...