patternprogram_305 softethics

Pattern 305

C

#include <stdio.h>
int main()
{
  int n=5; //size
  int i,j,s;

  for(i=n; i>=1; i--)
  {
    for(s=i; s<=n-1; s++)
    {
      printf(" ");
    }

    for(j=1; j<=i; j++)
    {
      if(i%2==0)
        printf("%c",i+64); // to get character
      else
        printf("%d",i);
    }

    printf("\n");
  }
}

C++

Java

C#

Python

0 0 votes
Rate this Program
Subscribe
Notify of
guest


0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments