-->

WAP to get following alphabetical pattern

/*WAP to get following

ABCDE
ABCD
ABC
AB
A
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char a='A';
int i,j,k=0;
for(i=4;i>=0;i--)
{
  for(j=0;j<=i;j++)
    {
      printf("%c",a+j);
    }
  printf("\n");

}
getch();
}
-----------------
logic in mind
1) we have to display different characters in different rows and columns.
2)there are five rows and columns. The column is decreased in each display.
3)for this, we have used first loop for different rows.
4)second loop is for display. It fetches value from first loop and displays different character.
5)second loop is taken from value 0.because,  in each display, the character changes so. 
for more: look down.
--------------
program screenshot:-



program output:-


to display letters' pattern

/*to display following
A
AB
ABC
ABCD
ABCDE
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char a='A';
int i,j,k=0;
for(i=1;i<=5;i++)
{
  for(j=0;j<i;j++)
    {
      printf("%c",a+j);
    }
  printf("\n");

}
getch();
}
-------------------
logic in mind:-
-------------
1) we have to display different characters in different rows and columns.
2)there are five rows and columns. The column is decreased in each display.
3)for this, we have used first loop for different rows.
4)second loop is for display. It fetches value from first loop and displays different character.
5)second loop is taken from value 0.because,  in each display, the character changes so.
for more: look down.
program screenshot:-


program output:-










to display letters' pattern

/*to display following
A
AB
ABC
ABCD
ABCDE
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char a='A';
int i,j,k=0;
for(i=1;i<=5;i++)
{
  for(j=0;j<i;j++)
    {
      printf("%c",a+j);
    }
  printf("\n");
  //a++;
}
getch();
}
-------------------
logic in mind:-
-------------
1) we have to display different characters in different rows and columns.
2)there are five rows and columns. The column is decreased in each display.
3)for this, we have used first loop for different rows.
4)second loop is for display. It fetches value from first loop and displays different character.
5)second loop is taken from value 0.because,  in each display, the character changes so.
for more: look down.
program screenshot:-


program output:-










to display letters' pattern

/*to display following
A
AB
ABC
ABCD
ABCDE
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char a='A';
int i,j,k=0;
for(i=1;i<=5;i++)
{
  for(j=0;j<i;j++)
    {
      printf("%c",a+j);
    }
  printf("\n");

}
getch();
}
-------------------
logic in mind:-
-------------
1) we have to display different characters in different rows and columns.
2)there are five rows and columns. The column is decreased in each display.
3)for this, we have used first loop for different rows.
4)second loop is for display. It fetches value from first loop and displays different character.
5)second loop is taken from value 0.because,  in each display, the character changes so.
for more: look down.
program screenshot:-


program output:-










Write a program to get following numeric pattern.

/*Write a program to get following numeric pattern.
0
01
012
0123                                                                                                                    
012
01
0
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,j;
for(i=0;i<=3;i++)
{
 for(j=0;j<=i;j++)
   {
      printf("%d",j);

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

   }
      printf("\n");
}
getch();
}
-------------------------------------------------
logic in mind:-
1) we have to display given pattern.It has two parts
      first part is:upper part .i..e
        0
       01
       012
        0123   
  and second part is
     012
     01
     0
2)for first part, like shown below, we use loop to fetch value from outer loop and displaying from inner loop
3)for second part, we use once again loop with one less value. We fetch that and display from inner loop
just look down.

program's screenshot:

----------------------------
output screen:



program to display following star pattern.

 /*program to display following star pattern.
         * * * * * *
           * * * *
            * * *
             * *
              *
             *
            * *                                                                                                           
           * * *
         * * * *
       * * * * * 
*/
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int i,j,k,sp=1;
//printf("for upper part");
 for(i=1;i<=5;i++)
   {
for(k=sp;k<=i;k++)
  {
    printf(" ");

     }
    for(j=5;j>=i;j-- )
      {
printf(" *");
    }
    printf("\n");
}
 //printf("for lower part");

 sp=5;
 for(i=1;i<=5;i++)
   {
for(k=sp;k>=i;k=k-1)
  {   printf(" ");

     }
    for(j=1;j<=i;j++)
      {
      printf(" *");
    }
    printf("\n");
}
getch();

}
-------------------------------
logic in mind:-
---------------------------------
1)First loop is for number of rows.
2)like other programs, we display first upper part. 
       For this, we, first, display space (second loop)and then star(third loop.
3)For second part, we display first space(look diagram) using loop then we display star.
------------------------------------------------------------------------------------------------------------------------------
program's screenshot:-


programs output:-



program to display following star pattern.

/*program to display following star pattern.
              *
             *     *                                                                                                  
             *            *
             *                   *
             * * * * * * * * *                
             * *
             *     *
             *         *
             *             *
             *                  *
             *  * * * * * * * *
             *
             *
             *
*/
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,k,m,sp=7;
//printf("first upper part");
for(i=1;i<=5;i++)
 {

for(m=i;m<= i;m++)
{
printf("*");
}
 for(m=1;m<i;m++)
 {
 printf("  ");
 }
   for(m=i;m<=i;m++)
    {
      if(m==1)
      printf(" ");
      else
      printf("*");

    }

 printf("\n");
 }
 for(i=1;i<=10;i++)
 {
 printf("*");
 }
//printf("second lower part");
for(i=1;i<=5;i++)
 {

for(m=i;m<= i;m++)
{
printf("*");
}
 for(m=1;m<i;m++)
 {
 printf("  ");
 }
   for(m=i;m<=i;m++)
    {
      if(m==1)
      printf(" ");
      else
      printf("*");

    }

 printf("\n");
 }
 for(i=1;i<=10;i++)
 {
 printf("*");
 }
  for(i=1;i<=5;i++)
 {
 printf("*\n");
 }
 getch();
 }
-------------------------------
logics in mind:-
-------------------------------
1)it contains three parts:
        first part is upper right angled triangle
        second part is lower right angled triangle
        third part is tail
If we combine them then we get that.
2) To get upper part we have already done. follow the link
            https://practicingclanguage.blogspot.com/2016/09/program-to-display-following-star_21.html
3)To get lower part, follow the link
        https://practicingclanguage.blogspot.com/2016/09/program-to-display-following-star_21.html
4) to get left part, use loop few number of times. It's done
---------------------------------------------------------------------------------
Follow following shot for more.

program screenshot:-

output screen shot:-