Create Your First Functional Component in React JS – Beginner's Guide

Image
Create Your First Functional Component in React JS  1. Introduction When you start learning React JS, one of the first things you will come across is the concept of components. At first, components may seem like just another programming concept, but they are actually the foundation of almost every React application. Think about a website you use every day. It may have a header, navigation menu, login form, product section, and footer. Instead of writing all these elements together in one large file, React allows us to create separate parts and manage them independently. These separate parts are called components. In this tutorial, we are going to create our first functional component in React. We will start with a very simple example and gradually understand how components are created, exported, imported, and displayed on a webpage.  2. What Is a Functional Component in React?   A functional component is simply a JavaScript function that returns a user interface using JSX...

C Program to Print Inverted half Pyramid of Number

C Program to Print Inverted half Pyramid


C Program to Print Inverted half Pyramid  of Number
Example 


#include<stdio.h>
void main ()
{
int i,j,r;

printf("enter the number");
scanf("%d",&r);
for(i=r;i>=1;i--)
{
for(  j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}


C Program to Print Inverted half Pyramid  of Number
Explain Program

Step :1

#include <stdio.h>

 standard input/output library.

Step :2

void main()

 main function where the program starts.

Step :3

Variable Declarations

int i, j, r;

r: The number of rows (user input).

i: Controls the outer loop (rows).

 j: Controls the inner loop (columns/numbers per row).

Step :4

printf("enter the number");

scanf("%d", &r);

 user to enter an integer value r

 the number of rows in the pattern

Step :5

Outer Loop (Row Control)

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

Start  from i = r and decrements down to 1.

Each iteration represent one row in the output.

 number of values printed in a row equals i.

Step :6

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

{

    printf("%d", j);

}

each row, this loop prints numbers starting from 1 up to i.

Step :7

printf("\n");

row move the cursor to the next line.

Step :8

return 0;

C Program to Print Inverted half Pyramid  of Number
 Program Output :- 


C Program to Print Inverted half Pyramids  of Number

Related Post :-

C Program Print Right Half Character Pyramid Pattern

C program print square star pattern


Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

CSS Outline Offset Property with Practical Examples