***** **** *** ** *
Required knowledge:
Basic C programming, For loopBefore printing this pattern logic of printing right triangle star pattern is recommended.
Program:
/** * Reverse right triangle star pattern program in C */ #include <stdio.h> int main() { int i, j, n; //Reads number of rows to be printed from user printf("Enter value of n : "); scanf("%d", &n); for(i=1; i<=n; i++) { for(j=i; j<=n; j++) { printf("*"); } //Moves to the next line/row printf("\n"); } return 0; }
Output
Enter value of n: 5
*****
****
***
**
*
*****
****
***
**
*
Screenshot:
Happy coding ;)
You may also like
- All star patterns programs index.
- For loop programming exercises and solutions.
- If else programming exercises and solutions.
- C program to print all alphabets from a to z.
- C program to print table of any number.
- C program to calculate sum of digits.
- C program to find reverse of any number.
- C program to check whether a number is palindrome or not.
- C program to print Pascal triangle of n rows.
- C program to find factorial of any number.
- C program to print fibonacci series.
- C program to check whether a number is Prime number or not.
- C program to print all prime numbers between 1 to n.
- C program to print sum of all prime numbers between 1 to n.