c program for printing Right half pyramid pattern

https://webdesigningtheory.blogspot.com/2025/03/number-pattern-program-in-c.html

 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

how to add background image in html.

HTML pre tag

How to insert image in html

Html anchor tag

Inline css in html