Pattern 16: C Program to print backslash star pattern using for loops
Write a C program to print the following backslash star pattern :
In this Article, We are going to print the backslash star pattern using the for loops.
Here are couple of sample outputs.
Example 1:
1 2 3 4 5 6 |
Enter the Number : 5 * * * * * |
Example 2:
1 2 3 4 5 6 7 8 9 10 11 |
Enter the Number : 10 * * * * * * * * * * |
Note: This program is one of the program in Series of Star Pattern programs in C.
Program to print backslash star pattern :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#include<stdio.h> int main() { int i,j,k,n; printf("Enter the Number : "); scanf("%d",&n); for(i=1; i<=n; i++) { for(j=1; j<=n; j++) { if(i==j) printf("* "); else printf(" "); } printf("\n"); } return 0; } |
Backslash Star Pattern Program Output:
BackSlash Pattern program output |
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.
A program with back and forward slash usage
/
/.
/.
A program with back and forward slash usage
/
/.
/.
Forward slash