Posts

Showing posts from April, 2025

Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

C Program to Print Alphabet J Star Pattern with Example

Image
  C program  pattern  C program to Print  Alphabet  J star pattern  Example  #include <stdio.h> int main () {     int a, b;     int n = 7 ; // Height of the J pattern     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b < n; b ++ ) {             // Print the vertical part of J             if (b == n / 2 && a != 0 ||                 (a == n - 1 && b <= n / 2 ) ||                 (a == n - 2 && b == 0 ))                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }   ...

C Program to Print Alphabet H Star Pattern with Example

Image
  C program  pattern  C program to Print  Alphabet  H star pattern  Example:- #include <stdio.h> int main () {     int a, b;     int n = 7 ;     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b < n;b ++ ) {             if (b == 0 || b == n - 1 || a == n / 2 )                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }     return 0 ; } C Program to Print Alphabet H Star Pattern with Example Explain Program Step :1 #include <stdio.h> standard input-output library use functions like printf().

c program to display alphabet pattern G with asterisk

Image
C Program  pattern C program to Print  Alphabet  G star pattern  Example :- #include <stdio.h> int main () {     int a, b;     int n = 7 ;     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b < n; b ++ ) {                         if ((a == 0 || a == n - 1 ) && b > 0 && b < n - 1 )                 printf ( "*" );                         else if ((b == 0 && a > 0 && a < n - 1 ))                 printf ( "*" );                         else if ((a == n / 2 && b >= n / 2 ) || (a >= n / 2 && b == n - 1 ))           ...

c program to display alphabet pattern F with asterisk

Image
 C Program C program to Print  Alphabet  F star pattern  Example :- #include <stdio.h> int main () {     int a, b;     int rows = 7 ;       for (a = 0 ; a < rows; a ++ ) {         for (b = 0 ;  b < rows; b ++ ) {                     if (a == 0 )           printf ( "*" );                         else if (a == rows / 2 && b < rows - 2 )             printf ( "*" );                         else if (b == 0 )                 printf ( "*" );             else                 printf ( " " );         }      ...

c program to display alphabet pattern I with asterisk

Image
C program  C program to Print  Alphabet  I star pattern  Example  #include <stdio.h> int main () {     int a, b;     int n = 7 ;       // print of the I     for (a = 0 ; a < n; a ++ ) {         for (b = 0 ; b < n; b ++ ) {                         // Print * for the top, middle, and bottom rows                         // or the vertical column in the middle                         if (b == n / 2 || a == 0 || a == n - 1 ) {                 printf ( "*" );             }             else             {                 printf (...

c program to display alphabet pattern E with asterisk

Image
  C program C program to Print  Alphabet E star pattern  Example #include <stdio.h> int main () {     int a,b;     int height = 7 ;     int width = 5 ;       for (a = 0 ; a < height;a ++ ) {         for (b = 0 ; b < width; b ++ ) {                         if (b == 0 || (a == 0 || a == height / 2 || a == height - 1 ))           printf ( "*" );         else           printf ( " " );         }         printf ( " \n " );     }     return 0 ; } c program to display alphabet pattern E with asterisk Explain Program Step :1 #include <stdio.h> standard input/output library for function printf() and scanf( )

C Program to Print Alphabet D Star Pattern with Example

Image
C Program C program to Print  Alphabet D star pattern  Example #include <stdio.h> int main () {     int i, j;     int n = 7 ;     for (i = 0 ; i < n; i ++ ) {         for (j = 0 ; j < n; j ++ ) {                         if (j == 0 ||                 (i == 0 && j < n - 1 ) ||                 (i == n - 1 && j < n - 1 ) ||                 (j == n - 1 && i != 0 && i != n - 1 ))                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }   ...

C Program to Print Alphabet C Star Pattern with Example

Image
C Program   C program to Print  Alphabet C star pattern  Example #include <stdio.h> int main () {     int a, b;     int rows = 7 ;     for (a = 0 ; a < rows; a ++ ) {         for (b = 0 ; b < rows;b ++ ) {                       if (a == 0 || a == rows - 1 || b == 0 ) {                               if ((a == 0 || a == rows - 1 ) && b > 4 )                     continue ;                 printf ( "*" );             } else {                 printf ( " " );             }         }         printf ( " \n " );   ...

C Program to Print Alphabet B Star Pattern with Example

Image
                                               C Program C program to Print B star pattern Asterisks pattern     Example:- #include <stdio.h> int main () {     int a, b;     int rows = 7 ;       for (a = 0 ; a < rows; a ++ ) {         for (b = 0 ; b < 5 ; b ++ ) {                         if (b == 0 ||                 (a == 0 && b < 4 ) ||                 (a == rows / 2 && b < 4 ) ||                 (a == rows - 1 && b < 4 ) ||                 (b == 4 && a != 0 && a != rows / 2 && ...

C Program to Print Alphabet A Star Pattern with Asterisks

Image
C program to Print A star pattern Asterisks pattern  Example:- #include <stdio.h> int main () {     int no = 7 ;     int i, j;     for (i = 0 ; i < no; i ++ ) {         for (j = 0 ; j <= no; j ++ ) {               if ((j == 0 || j == no) && i != 0 || (i == 0 && j > 0 && j < no) || (i == no / 2 ))                 printf ( "*" );             else                 printf ( " " );         }         printf ( " \n " );     }      return 0 ;     } This C Program Print a pattern in the shape of the capital letter A  using asterisks "*" Explain Program Step :1 #include <stdio.h> standard input-output library. Required for using printf...

C Program to print Hollow Hourglass pattern

Image
   C  Program  Hollow Hourglass pattern    C Program to print Hollow Hourglass pattern  Example :- #include <stdio.h>   int main () {   int i, j, k, rows;     printf ( "Enter the no. of rows: " );   scanf ( " %d " , & rows);     printf ( "Output: \n\n " );     for (i = 1 ; i <= rows; i ++ )   {     for (k = 1 ; k < i; k ++ )       printf ( " " );       for (j = i; j <= rows; j ++ )       printf ( "* " );       printf ( " \n " );   }     for (i = rows - 1 ; i >= 1 ; i -- )   {     for (k = 1 ; k < i; k ++ )       printf ( " " );       for (j = i; j <= rows; j ++ )       printf ( "* " );       printf ( " \n " );   }     return 0 ; } C Code for Printing a Hollow Hourglass Shape Explai...

C Program to Display a Hollow Diamond Shape with Star

Image
C Program   Pattern C Program to print Hollow Diamond Star Pattern Example :- #include <stdio.h> #include <stdlib.h> int main () { int i,j,rows; printf ( "Enter the number \n " ); scanf ( " %d " , & rows); for (i = 1 ; i <= rows; i ++ ){ for (j = rows; j > i; j -- ){ printf ( " " ); } printf ( "*" ); for (j = 1 ; j < (i - 1 ) * 2 ; j ++ ){ printf ( " " ); } if (i == 1 ){ printf ( " \n " ); } else { printf ( "* \n " ); } } for (i = rows - 1 ; i >= 1 ; i -- ){ for (j = rows; j > i; j -- ){ printf ( " " ); } printf ( "*" ); for (j = 1 ; j < (i - 1 ) * 2 ; j ++ ){ printf ( " " ); } if (i == 1 ){ printf ( " \n " ); } else { printf ( "* \n " ); } } return 0 ; } C Program to Display a Hollow Diamond Shape with Star Explain Program

C Program to Print Hollow Full Pyramid Using Stars Pattern

Image
C Program to print Hollow Full pyramid star Pattern C Program to print Hollow Full pyramid star Pattern Example :- #include <stdio.h> int main () { int i, space, row, star = 0 ; printf ( "Enter The Number " ); scanf ( " %d " , & row); for (i = 0 ; i < row - 1 ; i ++ ) { for (space = 1 ; space < row - i; space ++ ) { printf ( " " ); } for (star = 0 ; star <= 2 * i; star ++ ) { if (star == 0 || star == 2 * i) printf ( "*" ); else printf ( " " ); } printf ( " \n " ); } for (i = 0 ; i < 2 * row - 1 ; i ++ ){ printf ( "*" ); } return 0 ; } C Program to Print Hollow Full Pyramid Using Stars Pattern Explain Program Step :1 #include <stdio.h> int main() {     int i, space, row, star = 0; #include <stdio.h> :-  printf and scanf.   int i, space, row, star;: Declares loop variables and input variable.   row = number of levels of the pyramid.   i = controls outer loop (...