Pattern 30 : C program to print the forward-slash star pattern using for loops

Spread the love

Write a C Program to print below number pattern on the console:

Enter Number : 5
        * 
      * 
    * 
  * 

Note : This post is part of my series on Star Pattern programs in C language, Check out all program HERE.

Program :

  1. #include<stdio.h>
  2. int main()
  3. {
  4.    int i,j,k,n;
  5.    printf(“Enter Number : “);
  6.    scanf(“%d”,&n);
  7.  
  8.    for(i=1;i<=n;i++)
  9.    {
  10.       for(j=1;j<=n;j++)
  11.       {
  12.             if(<= (n+1i))
  13.             {
  14.                if( j == (n+1i) )
  15.                   printf(“* “);
  16.                else
  17.                   printf(”  “);
  18.             }
  19.       }
  20.       printf(n);
  21.    }
  22.    return 0;
  23. }

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