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 Print Inverted Pyramid and pattern

C Program Print Inverted Pyramid and pattern


C Program Print Inverted Pyramid and pattern

Example 


#include<stdio.h>
int main()
{

int i,j,row;
printf("enter number row");
scanf("%d",&row);
for(i=row;i>=1;i--)
{

for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch ();
}


C Program Print Inverted Pyramid and pattern

Explain Program

Step :1

Includes the standard input/output library for functions like printf() and scanf().

Step :2

     int main() {

 Start of the main function where the execution begins.

Step :3

int i, j, row;

Declares three integer variables:

i and j are loop counters.

Step :4

printf("enter number row");

printf("Enter number of rows: ");

integer input from the user and stores it in the variable row

Step :5

for(i=row; i>=1; i--)

for(i=row; i>=1; i--)

 outer loop that controls the number of rows.

  user-input number (row) and decreases by 1 each time until it reaches 1. 

Step :6

for(j=1; j<=i; j++)

for(j=1; j<=i; j++)

 inner loop which prints asterisks * in each row.

  prints i number of asterisks. 

Step :7

printf("*");

printf("*");

Prints one asterisk on the same line (no newline character). 

Step :8

printf("\n");

printf("\n");

After printing all the asterisks in one row, this moves the cursor to the next line.

  each row of asterisks is printed on a new line. 

Step :9

getch();

C Program Print Inverted Pyramid and pattern

 Program Output 

C Program Print Inverted Pyramid
Related Post :-

Website about us page html and css

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example