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

Spread the love

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

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

 Program to print Arrow 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 :

Related Programs :

More C programs:

C Tutorials with simple Examples:

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply