Pattern 16: C Program to print backslash star pattern using for loops

Spread the love

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

Enter the Number : 5
*        
  *      
    *    
      *  
        *

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

Program to print backslash star pattern :

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

Output:

BackSlash Pattern program output

More C programs:

  1. Program to calculate Maximum of three numbers.
  2. What are Prime Number and C program to Check given number is Prime or Not
  3. Check given Number is Prime or not Using Square Root(sqrt) Function.(Efficient way)
  4. C Program to generate prime numbers between two numbers
  5. C Program to generate first N prime numbers.
  6. C program to Calculate percentage of student.
  7. C Program to check given year is the leap or not.
  8. C Program to convert Temperature.
  9. C program to understand type conversation.
  10. Finding Largest of two numbers using the conditional operator in C.
  11. C program to calculate the simple Interest,
  12. C program to understand Size of Operator.
  13. 200+ 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...

3 Responses

  1. A program with back and forward slash usage
    /
    /.
    /.

  2. A program with back and forward slash usage
    /
    /.
    /.

Leave a Reply