Number pattern

C program to display integrated pyramid number pattern using while loop

C program to display integrated pyramid number pattern using while loop

In this tutorial, we will discuss a concept of  C program to display integrated pyramid number pattern using while loop

In the C programming  language, we can use for loop ,while loop and do-while loop to display different number (binary, decimal), alphabets or star pattern programs.

In this article, we are going to learn  how to Display integrated pyramid number pattern using while loop  in C language

C code to Integrated triangle number patterns

Integrated Triangle number pattern 1

Program 1

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,row;
    printf("Enter the number of rows: ");
    scanf("%d",&row);//Takes input fromt the user
    printf("\n");//move to next line
    i=1;
while(i<=row){
    j=i;
    while(j<=row){ //Print number
        printf("%d",j);
        j++;
    }
    i++;
    printf("\n");
}

i=row-1;
while(i>=1){
    j=i;
    while(j<=row){
        printf("%d",j);  //Print number
        j++;
    }
    i--;
    printf("\n");
}
getch();
    return 0;
}

When the above code is executed, it produces the following results

Integrated pyramid number pattern 1

 

 

Integrated Triangle number pattern 2

Program 2

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,row;
    printf("Enter the number of rows: ");
    scanf("%d",&row);//Takes input fromt the user
    printf("\n");
i=1;
while(i<=row){//print upper part of shape
    j=1;
while(j<i){
    printf(" ");//print space
    j++;
}
j=i;
    while(j<=row){
        printf("%d",j);//print number
        j++;
    }
    i++;
    printf("\n");//move to next line
}

i=row-1;
while(i>=1){//print lower part of shape
    j=1;
while(j<i){
    printf(" ");//print space
    j++;
}
j=i;
    while(j<=row){
        printf("%d",j);//print number
        j++;
    }
    i--;
    printf("\n");
}
getch();
    return 0;
}

When the above code is executed, it produces the following results

Integrated pyramid number pattern 2

 

Integrated Triangle number pattern 3

Program 3

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,row;
    printf("Enter the number of rows: ");
    scanf("%d",&row);//Takes input fromt the user
    printf("\n");

    i=1;
while(i<=row){
    j=1;
while(j<=i){
    printf(" ");
    j++;
}
j=i;
    while(j<=row){
        printf("%d",j);//print number
        printf(" ");//print space
        j++;
    }
    i++;
    printf("\n");//move to next line
}

i=row-1;
while(i>=1){
    j=1;
while(j<=i){
    printf(" ");//print space
    j++;
}
j=i;
    while(j<=row){
        printf("%d",j);//print number
        printf(" ");//print space
        j++;
    }
    i--;
    printf("\n");
}
getch();
return 0;

}

When the above code is executed, it produces the following results

integrated pyramid number pattern 3

Integrated Triangle number pattern 4

Program 4

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,row;
    printf("Enter the number of rows\n");
    scanf("%d",&row);//Takes input fromt the user
    printf("\n");
    i=1;
while(i<=row){
    j=1;
while(j<=row-i){
    printf(" ");
    j++;
}
j=1;
    while(j<=i){
        printf("%d",j);
        printf(" ");
        j++;
    }
    i++;
    printf("\n");
}

i=1;
while(i<=row-1){
    j=1;
while(j<=i){
    printf(" ");
    j++;
}
j=1;
    while(j<=row-i){
        printf("%d",j);
        printf(" ");
        j++;
    }
    i++;
    printf("\n");
}
getch();
    return 0;
}

When the above code is executed, it produces the following results

Integrated pyramid number pattern 4

 

 

Integrated Triangle number pattern 5

Program 5

include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows\n");
    scanf("%d",&rows);//Takes input fromt the user
    printf("\n");

    i=1;
while(i<=rows){
        j=1;
  while(j<=i){
  printf("%d",j);
   j++;
}

j=i*2;
while(j<rows*2){
  printf(" ");
   j++;
}

k=i;
while( k>=1){
  printf("%d",k);
   k--;
}

  printf("\n");

   i++;

}
getch();
    return 0;
}

When the above code is executed, it produces the following results

Integrated pyramid number pattern 5

 

Integrated Triangle number pattern 6

Program 6

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows\n");
    scanf("%d",&rows);//Takes input fromt the user
    printf("\n");

    i=rows;
while(i>=1){
j=1;
     while(j<=i){
         printf("%d",j);
          j++;
             }
j=i*2;
     while( j<rows*2-1){
         printf(" ");
          j++;
            }
k=i;;
     while( k>=1){
        if(k!=rows)
         printf("%d",k);
          k--;
              }
printf("\n");
 i--;
         }
         getch();
         return 0;
}

When the above code is executed, it produces the following results

Integrated pyramid number pattern 6

 

 

Integrated Triangle number pattern 7

Program 7

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows\n");
    scanf("%d",&rows);//Takes input fromt the user
    printf("\n");

    i=rows;
while(i>=1){
j=1;
     while(j<=i){
         printf("%d",j);

          j++;
             }
              printf("\n");
             i--;
}
i=1;
     while( i<rows){
         j=1;
         while(j<=i){
         printf("%d",j);

          j++;
             }
             printf("\n");

          i++;
         }
         getch();
    return 0;
}

When the above code is executed, it produces the following results

Integrated pyramid number pattern 7

 

 

Integrated Triangle number pattern 8

Program 8

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows\n");
    scanf("%d",&rows);//Takes input fromt the user
    printf("\n");

    i=rows;
while(i>=1){  //parent while loop
    j=rows;
  while(j>=1+rows-i){
  printf("%d",j);

   j--;

}
     j=i*2;
    while(j<rows*2-1){
  printf(" ");
  j++;

    }

    k=1+rows-i;
    while( k<=rows){
    if(k!=1)
  printf("%d",k);
 k++;

   }

  printf("\n");
  i--;

}
getch();
    return 0;
}

When the above code is executed, it produces the following results

Integrated pyramid number pattern 8

 

Similar post

Java program to display integrated pyramid number pattern using while loop

C++ program to display integrated pyramid number pattern using while loop

C++ code to Integrated triangle patterns using for loop

Java code to Integrated triangle patterns using for loop

Pascal Triangle pattern in Java Language using Array

C Language Pascal Triangle pattern in  using 2D Array

Java Language Pascal Triangle pattern in  using 2D Array

Java program to star Pyramid pattern

C# program to inverted star Pyramid pattern

Python program to star Pyramid pattern

 

 

 

Suggested for you

Data types  in C language

Variable in C language

While loop in  C  language

Nested while loop in C language

Operator in C language

 

 

C program to Integrated triangle patterns using for loop
C++ Program to display integrated pyramid number pattern using while loop
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

2 days ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago