C Program to Print Reverse Asterisk Pattern using For Loop

Today, we will share information and technique about how to write a C program that will Print Reverse Asterisk pattern. If you are a student of Computer Science or Software Engineering, then you should be excited to know that you are in the right place. On this website, we will teach you everything about coding. This website is all about coding.

Print Reverse Asterisk Pattern

In this article, we will teach you a C program that will Print Reverse Asterisk Pattern. This program will print asterisk(*) in reverse order. In the previous article, we discussed Easy C Program to Print Asterisk Pattern using For Loop 2022  which is bout to print the asterisk(*), but this program will print the asterisk(*) in reverse order.


Write a Program that will Print Reverse Asterisk(*) Pattern.

int main()
int i,j,num;
printf("enter number of rows to print Asterisk: ");


The above program will print the asterisk(*) pattern in reverse order. First of all, we have to take integer type variables which are i,j, and num. As nested for loop is used to print asterisk because pattern contains rows and columns, so we take i and j for nested for loop.

Then we have taken the num integer type to take value from the user, the value which will store in the num variable and printed on a pattern on the basis of the num integer variable. Then we used a nested for loop, in which we used two loops, one is an outer loop that is for rows and the other is an inner loop that is for columns.

We have initialized i=num and applied the condition as i>=1. This is for reverse pattern, it will print 5 asterisks in first row, 4 in second, 3 in third, 2 in fourth and 1 in last row. Than we have used another loop, which is for column. We have have initialized j=1 and we have applied condition as j<=i, which means that it will run until j become equal to i.

This condition is main condition which will print pattern. In for loop, we have used print statement in which we printed Asterisk(*). then after inner loop, we have used print statement in outer loop which will print \n, which means it will print a new line every time.

First of all program will check for loop, then it will check the condition, if condition is true, then it will proceed to the body of loop. Then there is another loop, program will check its condition, if condition becomes true then it will proceed to the body and will print asterisk(*). This loop will continue until it condition becomes wrong.


From above program, we concluded that we can Print Reverse Asterisk Pattern in C language using for loop. This program will print reverse pattern of Asterisk, you can print digits by replacing Asterisk(*) to %d in print statement. You can also print this program by while loop and do-while loop, by which you feel easy you can use.

Leave a Reply

Your email address will not be published. Required fields are marked *