Print inverted right angle triangle Pattern - C

Write a program to print following output:

inverted triangle

Solution:

#include<stdio.h>
int main()
{
      int i,a,b;
      for(a=5, b=1; b<=5;a--,b++)
      {
            for(i=1;i<b;i++)
            printf(" ");
            for(i=1;i<=a;i++)
            printf("*");
            printf("\n");
      }
      return 0;
}


Output:

inverted right angle triangle