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 for printing Right half pyramid pattern

c program for printing Right half pyramid pattern


 c program for printing Right half pyramid pattern 

Example 


#include<stdio.h>
int main() {
int i,j ,row;
printf("enter the number of row");
scanf("%d",&row);
for(i=1; i<=row; i++)
  {
  for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
 }
getch();
}


c program for printing Right half pyramid pattern
Explain Program

Step :1

#include<stdio.h>

  • Standard Input/Output library to use functions  printf() and scanf().

Step :2

int main() {

  • main function where your program starts execution.

Step :3

int i, j, row;

  • Declares three integer variables:
  • i and j for loop counters.
  • row to store the number of rows entered by the user.

Step :4

printf("enter the number of row");

  •  user to enter how many rows they want in the pattern.

Step :5

 scanf("%d", &row);

  •  input and stores it in the variable row.

Step :6

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

  • Outer loop run from 1 .

Step :7

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

  • Inner loop that run from 1 to i.

Step :8

printf ("%d", i);

  • Print the current row number (i) in the same line.

Step :9

printf("\n");

  • Moves the cursor  next line after printing one row of numbers.

Step :10

getch();

c program for printing Right half pyramid pattern

 Program Output :- 

Write C Program to Print  Right Half Right  Pyramid  Pattern

Related Post :-

HTML Multiple quetion MCQ

 C program print Right Half Pyramid 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