Simple C Program for Print Triangle Pattern
Simple C Program for Print Triangle Pattern - Example C Program
/*## Simple C Program for Print Triangle Pattern - Example C Program */
/*## Basic Pattern Programs, Triangle Pattern C Programming*/
#include <stdio.h>
int main() {
// Declare Variables
int rows,i,j;
//Read Day Value
printf("Enter the number of rows : ");
scanf("%d",&rows);
//Print Triangle Pattern
for (i = 0; i < rows; i++){
for (j = rows; j > i; j--){
printf(" ");
}
for (int k = 1; k <= i + 1; k++) {
printf(" *");
}
printf("\n");
}
return 0;
}
Sample Output:
Enter the number of rows : 8
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
Read More Articles
- Use of getch(),getche() and getchar() in C
- Switch Case Statement Example Program In C Programming Language
- C Character Set
- Convert a Floating-point value to an Integer in C
- Data Input and Output gets and puts Example Program In C
- Special Operators In C
- Pointer Representation and Pointer Example Programs
- C Data Input and Data Output
- Simple While Loop Example Program In C Programming Language
- Data Output printf and putchar Example Program In C
- C Introduction
- C Operators
- Storage Classes In C
- C Pointers
- File Management
- C Identifiers
- Loop Control Statements
- Hello World - Simple C Program
- C Array
- Single Character Output Function : putchar()
- C Reserve Words
- C Specific Properties and Implementation
- If else Statement Example Program In C Programming Language
- If Statement Example Program In C Programming Language
- Confusing Array in C ( Array Representation and Initialization )