pattern 10: C Program to print triangle Star pattern ( Pencil Shape Pattern)
We are going to write a C program to print the Pencil Shape Pattern using the stars. We will use the two for loops. One is outer for loop another is inner for loop.
The Outer for loop is responsible for the Rows printing and Inner for loop is responsible for Columns printing.
The program should take the input from the user. And print the pencil shape pattern like below.
For example, If the user input is 5. The program should print following output.
Write a C Program to print below pattern (Pencil Shape Pattern):
Note: This is one theSeries of pattern programs in C.
Pencil Shape Pattern Program :
printf("Enter the Value for n : ");
for(i=-n; i<=n; i++) // Note that 'i' is starting from -n (negative n)
for(j=0; j<=n; j++)
Pencil Shape Pattern Program Output:
Similar Star pattern programs:
- Basic star pattern program (The square pattern with stars).
- Triangle star pattern program.
- Triangle star pattern program with Spaces.
- Pyramid star pattern.
- Reverse Pyramid program.
- Diamond Star pattern program.
- star pattern program.
- K-Star pattern program.
More C programs:
- Program to calculate Maximum of three numbers.
- What are Prime Number and C program to Check given number is Prime or Not
- Check given Number is Prime or not Using Square Root(sqrt) Function.(Efficient way)
- C Program to generate prime numbers between two numbers
- C Program to generate first N prime numbers.
- C program to Calculate percentage of student.
- C Program to check given year is the leap or not.
- C Program to convert Temperature.
- C program to understand type conversation.
- Finding Largest of two numbers using the conditional operator in C.
- C program to calculate the simple Interest,
- C program to understand Size of Operator.
- 200+ C Programs.
C Tutorials with simple Examples:
- Arithmetic Operators with Examples.
- Arithmetic operators priority and it’s Associativity.
- Modulus Operator and Hidden Concepts of Modulus Operator.
- Precedence Table or Operators Priority Table.
- Assignment Operator, Usage, Examples
- Increment Operator and Different types of Increment operators Usage with Examples.
- Decrement Operator and Different types of Decrement operators with Examples.
- Logical or Boolean Operators.