Number pattern

C program to Integrated triangle patterns using for loop

C program to Integrated triangle patterns using for loop

In this tutorial, we will discuss a concept of  C program to Integrated triangle patterns using for loop

In C  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 triangle patterns  using for loop in C language

C code to Integrated triangle star patterns

Integrated Triangle star pattern 1

Program 1

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

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows: ");
    scanf("%d",&rows);  //get input from user for rows
    for(i=1; i<=rows; i++){  //parent for loop
  for(j=1; j<=i; j++){
  printf("*");

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

}

for(k=i; k>=1; k--){
  printf("*");

}

  printf("\n");

}
getch();
    return 0;
}

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

Integrated triangle patterns

 

Integrated Triangle star pattern 2

Program 2

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

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows: ");
    scanf("%d",&rows); //get input from user for rows
    for(i=rows; i>=1; i--){   //parent for loop
  for(j=rows; j>=1+rows-i; j--){
  printf("*");

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

}

for(k=1+rows-i; k<=rows; k++){
    if(k!=1)
  printf("*");

}

 printf("\n");

}
getch();
    return 0;
}

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

Integrated triangle patterns

 

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,k,rows;
    printf("Enter the number of rows: ");
    scanf("%d",&rows);    //get input from user for rows
    for(i=1; i<=rows; i++){     //parent for loop
  for(j=1; j<=i; j++){
  printf("%d",j);

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

}

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

}

  printf("\n");

}
getch();
    return 0;
}

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

Integrated triangle patterns

 

 

Integrated Triangle number pattern 2

Program 2

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

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows: ");
    scanf("%d",&rows);     //get input from user for rows
    for(i=rows; i>=1; i--){      //parent for loop
  for(j=rows; j>=1+rows-i; j--){
  printf("%d",j);

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

}

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

}

 printf("\n");

}
getch();
    return 0;
}

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

Integrated triangle patterns

 

Integrated Triangle number pattern 3

Program 3

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

int main()
{
    int i,j,k,rows;
    printf("Enter the number of rows: ");
    scanf("%d",&rows);    //get input from user for rows
    for(i=rows; i>=1; i--){

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

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

     for(k=i; k>=1; k--){
        if(k!=rows)
         printf("%d",k);
              }
printf("\n");

         }
         getch();
    return 0;
}

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

Integrated triangle pattern

Similar post

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

C language data types

C language variables

For loop in C language

Nested for loop 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

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

Java program to check odd or even using recursion

Java program to check odd or even using recursion In this tutorial, we discuss a…

2 months ago