Pattern 15: C Program to print Irregular polyhedron star pattern with out spaces.
Write a C program to print the following Irregular polyhedron star pattern :
In this Article, We are going to print the Irregular polyhedron star pattern using the for loops. We will two for loops Outer For loop and inner for loop. Outer for will helps us to print the Rows. And Inner for loop will helps us to print the columns
* * * * *
* * * *
* * *
* * *
* * * *
* * * * *
Seems like Above output is not displaying properly. Here is the expected output in Image Format.
Note: This program is the similar program to Pattern 14 but without the spaces in between two triangles.
Here I am using continue keyword, It will take the execution of the program to next iteration on other words it simply skips the execution of present iteration and goes to next iteration. So in pattern 14 program iteration 0 is causing spaces, So I am just skipping that iteration by using continue.
Irregular polyhedron star pattern Program:
printf("Enter any value : ");
// Start with -num and continue till the num
for(i=-num; i<=num; i++)
// If i==0, Skip the Iteration
k = k * -1;
for (j = 0; j < num; ++j)
if (j < (k+num))
Note: If you want spaces in between two triangles just delete continue statement in the loop, Please Refer to the following post for more details. “Polyhedron with spaces”.
Related 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.
- Empty Rhombus program.
- X-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.