{ A destination to learn coding }

Pattern - Inverted Half Pyramid using *

* * * * *
* * * *
* * *
* *
*

#include <stdio.h>
int main()
{
  int i,j,a;
  printf("Enter the number of rows\n");
  scanf("%d",&a);

  for(i=a;i>0;i--)
  {
    for(j=i;j>=1;j--)
    {
      printf("*");
    }
    printf("\n");
  }
  return 0;
}

Pattern - Inverted Half Pyramid using Alphabets

A A A A A
B B B B
C C C 
D D 
E

#include <stdio.h>
int main()
{
  int i,j,a;
  char c='A'
  printf("Enter the number of rows\n");
  scanf("%d",&a);

  for(i=a;i>0;i--)
  {
    for(j=i;j>=1;j--)
    {
      printf("%c",c);
    }
    c++;
    printf("\n");
  }
  return 0;
}

Pattern - Inverted Half Pyramid using Numbers

1 1 1 1 1
2 2 2 2 
3 3 3 
4 4 
5 

#include <stdio.h>
int main()
{
  int i,j,a,n=1;
  printf("Enter the number of rows\n");
  scanf("%d",&a);

  for(i=a;i>0;i--)
  {
    for(j=i;j>=1;j--)
    {
      printf("%d",n);
    }
    n++;
    printf("\n");
  }
  return 0;
}

Pattern - Inverted Half Pyramid using Numbers

1 2 3 4 5
1 2 3 4 
1 2 3 
1 2 
1

#include <stdio.h>
int main()
{
  int i,j,a;
  printf("Enter the number of rows\n");
  scanf("%d",&a);

  for(i=a;i>0;i--)
  {
    int n=1;
    for(j=i;j>=1;j--)
    {
      printf("%d",n);
      n++;
    }
    printf("\n");
  }
  return 0;
}