Pattern 17 : Arrow star pattern program in C language using Patterns.

Spread the love

Write a C program to print the following Arrow star pattern using for loops:

C Program to print the Arrow star pattern here is an example output, if the user input is 5.

Arrow-star-pattern-program-in-c-programming

Note: This program is one of the program in Series of Star Pattern programs in C

 Program to print Arrow star pattern on Console:

  1. #include<stdio.h>
  2. int main()
  3. {
  4.    int i,j,k,num;
  5.    printf(“Enter any value : “);
  6.    scanf(“%d”,&num);
  7.    for(i=-num;i<=num;i++)
  8.    {
  9.       k=i;
  10.       if(k<0)
  11.       {
  12.          k = k * 1;
  13.       }
  14.       for (= 0; j <= num; ++j)
  15.       {
  16.          if (j<k)
  17.          {
  18.             printf(”  “); // two spaces
  19.          }
  20.          else
  21.          {
  22.             printf(“*”);  // one star only
  23.          }
  24.       }
  25.       printf(“\n);
  26.    }
  27.    return 0;
  28. }

Output :

Arrow-star-pattern-in-c-language

Related Programs :

More C programs:

C Tutorials with simple Examples:

Venkat

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply